Skip to content

Add CPU unit tests for models/rf3; tidy a mypy suppression#316

Closed
lyskov-ai wants to merge 7 commits into
RosettaCommons:productionfrom
lyskov-ai:0033-rf3-paired-msa-file-level-mypy-ignore
Closed

Add CPU unit tests for models/rf3; tidy a mypy suppression#316
lyskov-ai wants to merge 7 commits into
RosettaCommons:productionfrom
lyskov-ai:0033-rf3-paired-msa-file-level-mypy-ignore

Conversation

@lyskov-ai

Copy link
Copy Markdown
Contributor

Two related pieces of test/type-checking work on models/rf3, no behavioural changes to the model.

CPU unit tests for models/rf3 (the bulk of the diff). Fixture-backed tests pinning the model's pure numeric and behavioural contracts with tiny committed fixtures — no GPU, downloaded checkpoints, or cluster data — so they run in the standard CI environment:

  • Loss functions & gradients (distogram and smoothed-LDDT losses; the closed-form dihedral-MSE gradient checked against autograd; chiral-gradient routing).
  • Symmetry-resolution geometry (Kabsch alignment recovery + reflection correction; residue-automorphism selection).
  • Model layers (layer_utils shape helpers, the MLFF conformer embedding, triangle attention/multiplication vanilla path, outer-product mean).
  • Metrics (chiral metric orchestration; predicted-TM and interface-TM scoring).
  • The diffusion sampler's noise schedule and initial-structure construction, plus assorted utility helpers.

mypy suppression tidy-up. rf3/data/paired_msa.py cannot type-check (it subclasses an atomworks class that the current atomworks turned into a factory function, so it also fails to import) and a real fix needs a refactor onto atomworks' PandasDataset API validated on cluster data. Previously it was silenced via a [[tool.mypy.overrides]] ignore_errors entry in pyproject.toml; that central list is silent and never warns when an entry becomes stale. This moves the suppression to a file-level # mypy: ignore-errors directive in the module itself — the module stays in mypy's scope, the reason is documented at the top of the file, and deleting that one line re-enables full checking once the module is fixed.

lyskov and others added 7 commits June 9, 2026 17:49
…_module

Cover the pure numeric helpers in rf3.loss.loss and rf3.util_module:

- calc_ddihedralmse_dxyz: the hand-derived closed-form dihedral-loss
  gradient, pinned against torch.autograd of a mirrored forward, plus
  zero-at-truth and leading-dim shape preservation.
- calc_chiral_grads_flat_impl: empty-centres, scatter routing onto only
  the centre atoms, index_add_ accumulation for shared atoms, and the
  no_grad_on_chiral_center flag.
- rbf: Gaussian distance-encoding (feature dim, exact values, [0,1]).
- init_lecun_normal: module returned, Parameter weight, +/-2*stddev
  bound, and Lecun std sqrt(scale/fan_in).

Test-only; both modules are already mypy-clean. Tests run in float32
(the production coordinate dtype).

Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
…duct layer

Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
…helpers

Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
Replace the central pyproject ignore_errors override for rf3.data.paired_msa with a file-level '# mypy: ignore-errors' directive in the module itself. The module is broken against the installed atomworks (subclasses a now-function) and needs a PandasDataset-API refactor to clear honestly; keeping it in mypy's files scope with an in-file directive makes the suppression visible at the point of breakage and re-enables checking the moment the directive is removed.

Co-authored-by: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com>
@lyskov-ai lyskov-ai requested a review from woodsh17 June 9, 2026 23:32
@lyskov-ai

Copy link
Copy Markdown
Contributor Author

Closing as redundant: this PR's cumulative diff is fully contained in #321, which was squash-merged into production (commit e412591). All of its changes are now in production.

@lyskov-ai lyskov-ai closed this Jun 16, 2026
@lyskov-ai lyskov-ai deleted the 0033-rf3-paired-msa-file-level-mypy-ignore branch June 16, 2026 19:50
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.

2 participants