Skip to content

Free memory by deleting random_phi after use - #28

Open
roi-meir wants to merge 1 commit into
simslab:masterfrom
roi-meir:free-memory-random-phi
Open

Free memory by deleting random_phi after use#28
roi-meir wants to merge 1 commit into
simslab:masterfrom
roi-meir:free-memory-random-phi

Conversation

@roi-meir

@roi-meir roi-meir commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Copilot AI lite review requested due to automatic review settings August 6, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces peak memory usage during model fitting by explicitly releasing the temporary random_phi Dirichlet matrix immediately after it is used to initialize Xphi_data on the first training iteration (t == 0 with reinit).

Changes:

  • Deletes random_phi right after computing Xphi_data in the t == 0 and reinit initialization path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread schpf/scHPF_.py
random_phi = np.random.dirichlet( np.ones(nfactors),
X_batch.data.shape[0])
Xphi_data = X_batch.data[:,None] * random_phi
del random_phi # free memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Free memory after initializing random_phi during first training iteration

2 participants