Skip to content

Make --mix_dtype work in SNP/ISM scoring; add --compile - #3

Merged
davek44 merged 3 commits into
mainfrom
seqnn-output-slice-tensor
Oct 5, 2026
Merged

davek44 merged 3 commits into
mainfrom
seqnn-output-slice-tensor

Conversation

@davek44

@davek44 davek44 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • -m/--mix_dtype now takes effect in hound_snp. It never set SeqNN.mix_dtype, so SeqNN.__call__'s own float32 autocast turned the requested bf16/fp16 back off (output bitwise identical to fp32).
  • SeqNN.__call__ returns float32 predictions whatever the autocast dtype. Reduced-precision outputs crashed scoring on CPU (numpy has no bfloat16; hound_ism_snp -m bfloat16 always failed this way) and would sum imprecisely.
  • Warning on reduced precision (snps.parse_mix_dtype, shared by hound_snp/hound_ism_snp/hound_ism_bed). On Cerberus, bf16 variant scores correlate with fp32 at only r ≈ 0.57–0.78 (random-sequence test), because rounding noise swamps small alt − ref differences. A GTEx eQTL comparison is pending.
  • -m restricted to float32|bfloat16|float16; hound_snp_folds gains -m and passes it through.
  • --compile for hound_snp, hound_ism_snp, hound_ism_bed and their _folds wrappers: SeqNN.compile() after restore, default mode. 1.33× steady-state per SNP for Cerberus at fp32 on an RTX 4090 (scores r ≥ 0.990 vs eager). reduce-overhead gives no further gain and breaks hound_snp (CUDA graphs overwrite held ref outputs), so it isn't offered.
  • SeqNNMod.output_slice stored as an index-tensor buffer. A pandas Index made dynamo skip SeqNNMod.forward; it now traces as one graph. Non-persistent, so checkpoints are unchanged.

Companion: calico/westminster 966ff91 adds -m/--compile to westminster_eqtl_folds.

Test plan

  • test_snp, test_ism_snp, test_ism_bed, test_snp_folds, test_model on CPU (48 passed, 1 GPU-only skip)
  • GPU (RTX 4090): test_snp -k "compile or mix_dtype" (5 passed), including compiled vs eager agreement
  • New tests: -m bfloat16 changes scores and warns; folds pass -m/--compile; ISM runs in bf16

🤖 Generated with Claude Code

davek44 and others added 3 commits October 4, 2026 17:50
A pandas Index output_slice (e.g. targets_df.index from hound_snp) made
torch.compile skip SeqNNMod.forward entirely (graph break inside the head
loop). As a non-persistent long-tensor buffer it traces into a single
graph, follows .to(device), and leaves the state_dict unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- hound_snp never set SeqNN.mix_dtype, so SeqNN.__call__'s inner
  float32 autocast disabled the requested bf16/fp16: -m was a no-op.
- SeqNN.__call__ now returns float32 predictions; reduced-precision
  outputs crashed scoring (numpy has no bfloat16) and summed imprecisely.
- hound_snp_folds gains -m and passes it through.
- -m is restricted to float32/bfloat16/float16 in all scripts.
- snps.parse_mix_dtype warns that reduced precision can dominate
  variant effect scores (small alt - ref differences).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hound_snp, hound_ism_snp, hound_ism_bed and their _folds wrappers gain
--compile, which calls SeqNN.compile() after restore. Default mode only:
reduce-overhead's CUDA graphs overwrite outputs held across calls (ref
predictions). SeqNN.compile only queries CUDA capability on CUDA devices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davek44
davek44 force-pushed the seqnn-output-slice-tensor branch from 2c0d58f to 99a7f9f Compare October 5, 2026 01:30
@davek44 davek44 changed the title Make output slicing compile-friendly and enable SNP mixed precision Make --mix_dtype work in SNP/ISM scoring; add --compile Oct 5, 2026
@davek44
davek44 merged commit 535777c into main Oct 5, 2026
2 of 3 checks passed
@davek44
davek44 deleted the seqnn-output-slice-tensor branch October 5, 2026 01:31
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