Skip to content

Free memory after initializing random_phi during first training iteration #27

Description

@roi-meir

Summary

During the first training iteration (when reinit is true), scHPF allocates a temporary random_phi Dirichlet matrix to initialize Xphi_data. That array is not deleted afterward, so it can linger until the next GC cycle and inflate peak memory use—especially with large batches / many nonzeros.

Proposed fix

Delete random_phi immediately after it is used to construct Xphi_data:

Xphi_data = X_batch.data[:,None] * random_phi
del random_phi  # free memory

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions