Skip to content

Replace debug flag with per-topic env vars in ContrastiveModel - #26

Merged
mojtababahrami merged 3 commits into
mainfrom
feature/debug-env-vars
Aug 4, 2026
Merged

Replace debug flag with per-topic env vars in ContrastiveModel#26
mojtababahrami merged 3 commits into
mainfrom
feature/debug-env-vars

Conversation

@mojtababahrami

Copy link
Copy Markdown
Collaborator

Summary

  • Removes the debug: bool = False constructor argument from ContrastiveModel and replaces it with five independent environment-variable flags, one per debug topic:
    • SCCONCEPT_DEBUG_BATCH_VALUES — raw batch values for the first few train batches
    • SCCONCEPT_DEBUG_SEQLEN_CORR — correlation between logits and sequence length
    • SCCONCEPT_DEBUG_ARGMAX_MATCH — periodic argmax/match diagnostics during training
    • SCCONCEPT_DEBUG_PANELS — panel consistency validation during validation
    • SCCONCEPT_DEBUG_PREDICT_BATCH — batch tokens/values during predict_step
  • Each flag can be toggled independently at runtime (e.g. SCCONCEPT_DEBUG_PANELS=1) without changing model construction code.
  • No callers in the codebase passed debug= explicitly, so this is backward compatible.

Test plan

  • python -m py_compile src/concept/model.py / AST parse succeeds
  • Confirmed no other code (train.py, train_fabric.py, api.py, tests) passes debug= to ContrastiveModel
  • No new automated tests added (user opted to skip, since this is a non-behavioral logging refactor)

🤖 Generated with Claude Code

mojtababahrami and others added 3 commits August 4, 2026 14:34
…eModel

Debug logging was gated by a single constructor arg that toggled five
unrelated log statements together. Split into SCCONCEPT_DEBUG_BATCH_VALUES,
SCCONCEPT_DEBUG_SEQLEN_CORR, SCCONCEPT_DEBUG_ARGMAX_MATCH, SCCONCEPT_DEBUG_PANELS,
and SCCONCEPT_DEBUG_PREDICT_BATCH so each debug topic can be enabled
independently at runtime without touching model construction code.

Co-Authored-By: Claude <[email protected]>
Adds SCCONCEPT_DEBUG_SAMPLE_STATS so per-step sample_stats can be
inspected via logger.debug without enabling any of the other debug
topics.

Co-Authored-By: Claude <[email protected]>
Adds SCCONCEPT_DEBUG_PRECOMP_EMBS to log whether precomputed
embeddings are used at each training/validation step, independent
of the other debug topics.

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

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.99%. Comparing base (060ace7) to head (a434578).

Files with missing lines Patch % Lines
src/concept/model.py 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
+ Coverage   66.92%   66.99%   +0.07%     
==========================================
  Files          22       22              
  Lines        2990     3003      +13     
==========================================
+ Hits         2001     2012      +11     
- Misses        989      991       +2     
Files with missing lines Coverage Δ
src/concept/model.py 69.32% <89.47%> (+0.31%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mojtababahrami
mojtababahrami merged commit a49b310 into main Aug 4, 2026
7 checks passed
@mojtababahrami
mojtababahrami deleted the feature/debug-env-vars branch August 4, 2026 13:01
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