babel: keep ATAC/RNA sparse instead of densifying up front (re-apply #61) - #66
Open
benjaminfreyuu wants to merge 1 commit into
Open
babel: keep ATAC/RNA sparse instead of densifying up front (re-apply #61)#66benjaminfreyuu wants to merge 1 commit into
benjaminfreyuu wants to merge 1 commit into
Conversation
Re-applies PR openproblems-bio#61, whose merge commit was dropped when main's history was rewritten (the 2026-08-14 08:03 run still hit the old 222 GiB densify crash on pbmc_multiome). babel_train densified the full ATAC (and RNA) matrix via _to_dense() before building the Dataset, which OOMs on real ATAC data (2022 pbmc_multiome tried to allocate 222 GiB for a 130095 x 228942 float64 array). Restore the original BABEL approach: keep matrices sparse (CSR), densify one cell at a time in PairedDataset.__getitem__; babel_predict binarizes sparsely and infers in cell chunks. Verified previously: viash test passes for babel_train (1/1) and babel_predict (1/1); on a synthetic 20k x 60k ATAC the sparse path peaks at 1.7 GB vs the old toarray() path being OOM-killed under 6 GB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-applies #61, which was merged (commit
ef7a4209, 2026-08-14 04:10) but is no longer inmain— main's history was rewritten afterwards and dropped the merge, so the 2026-08-14 08:03 benchmark run still hit the old crash.Problem
babel_traindensified the full ATAC matrix (_to_dense) before building the Dataset. On the 2022pbmc_multiome/swapdata this crashes:(Confirmed again in
run_2026-08-14_08-03-58.) It only passed on the tiny 2021 fixture (1.5k peaks).Fix
Restore the original BABEL approach (
wukevin/babel): keep matrices sparse (CSR) and densify one cell at a time inPairedDataset.__getitem__(mirrors BABEL'sensure_arr(X[i]).flatten()). Peaks sliced per chromosome on a CSC view.babel_predictbinarizes sparsely and infers in cell chunks.Verification
viash test babel_train→ 1/1 passed;viash test babel_predict→ 1/1 passed.toarray()path is OOM-killed under a 6 GB cap.🤖 Generated with Claude Code