implemented span masking - #3
Conversation
There was a problem hiding this comment.
Pull request overview
Adds two new MLM masking strategies — span (geometric-length contiguous APE-token spans) and hetero_span (span starts biased toward APE tokens that contain heteroatom SELFIES brackets) — to MolecularMLMCollator, plus CLI flags, validation, and tests. The standard Bernoulli path is preserved as the default.
Changes:
- New
masking_strategy,span_p_geom,span_max_length,heteroatom_start_weightargs (CLI + collator), with validation in bothvalidate_argsand__post_init__, and span/hetero_span sampling implemented per-row in Python. - Heteroatom detection via a
ClassVarregex over APE token strings, weighting span-start sampling forhetero_span. - New test module
tests/test_span_masking.pycovering validation, shape/dtype parity, special/pad invariants, contiguous-run formation, and weight-tensor construction; minor.gitignoretweak.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/modernmolbert/train_selfies_ape_modernbert.py | Adds CLI args, validation, and span / heteroatom-biased span masking implementation in the collator; wires ids_to_tokens through main(). |
| tests/test_span_masking.py | New test suite for the span and hetero_span strategies and backwards compatibility of the standard path. |
| .gitignore | Adds /*plan*.md and broadens repomix*.xml to *repomix*.xml. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Pull request overview
Adds two new MLM masking strategies —
span(geometric-length contiguous APE-token spans) andhetero_span(span starts biased toward APE tokens that contain heteroatom SELFIES brackets) — toMolecularMLMCollator, plus CLI flags, validation, and tests. The standard Bernoulli path is preserved as the default.Changes:
masking_strategy,span_p_geom,span_max_length,heteroatom_start_weightargs (CLI + collator), with validation in bothvalidate_argsand__post_init__, and span/hetero_span sampling implemented per-row in Python.ClassVarregex over APE token strings, weighting span-start sampling forhetero_span.tests/test_span_masking.pycovering validation, shape/dtype parity, special/pad invariants, contiguous-run formation, and weight-tensor construction; minor.gitignoretweak.Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.
File Description
src/modernmolbert/train_selfies_ape_modernbert.py Adds CLI args, validation, and span / heteroatom-biased span masking implementation in the collator; wires ids_to_tokens through main().
tests/test_span_masking.py New test suite for the span and hetero_span strategies and backwards compatibility of the standard path.
.gitignore Adds /plan.md and broadens repomix*.xml to repomix.xml.