Skip to content

Fix precomputed embeddings not being wired through to the model - #27

Merged
mojtababahrami merged 1 commit into
mainfrom
fix/precomp-embeddings
Aug 4, 2026
Merged

Fix precomputed embeddings not being wired through to the model#27
mojtababahrami merged 1 commit into
mainfrom
fix/precomp-embeddings

Conversation

@mojtababahrami

Copy link
Copy Markdown
Collaborator

Summary

  • api.py never passed precomp_embs_key into ContrastiveModel when constructing or loading the model, so self.precomp_embs_key stayed None and the model always fell back to computing embeddings from scratch instead of using precomputed ones.
  • AnnDataModule passed obsm_keys=precomp_embs_key (a bare string) instead of wrapping it in a list, which is what the underlying dataset class expects.
  • predict_step unconditionally normalized cell_embs, even when precomp_embs_key is set, which is inconsistent with _step's distance-based (unnormalized) logic for precomputed embeddings.

Test plan

  • python -m py_compile on the changed files
  • No new automated tests added (user opted to skip, since this is a targeted bug fix)

🤖 Generated with Claude Code

precomp_embs_key was never passed to ContrastiveModel when
constructing or loading it in api.py, so the model always fell back
to computing embeddings from scratch instead of using precomputed
ones. Also fixes AnnDataModule passing obsm_keys as a bare string
instead of a list (as expected by the underlying dataset class), and
skips cell_embs normalization in predict_step when precomp_embs_key
is set, matching the non-normalized distance-based logic used in
_step.

Co-Authored-By: Claude <[email protected]>
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.03%. Comparing base (a49b310) to head (c8d0b34).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   66.99%   67.03%   +0.03%     
==========================================
  Files          22       22              
  Lines        3003     3006       +3     
==========================================
+ Hits         2012     2015       +3     
  Misses        991      991              
Files with missing lines Coverage Δ
src/concept/api.py 76.71% <100.00%> (+0.04%) ⬆️
src/concept/data/datamodules.py 90.85% <100.00%> (+0.05%) ⬆️
src/concept/model.py 69.37% <100.00%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mojtababahrami
mojtababahrami merged commit c24a7e2 into main Aug 4, 2026
7 checks passed
@mojtababahrami
mojtababahrami deleted the fix/precomp-embeddings branch August 4, 2026 13:16
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.

1 participant