Skip to content

implemented span masking - #3

Merged
jsture merged 5 commits into
mainfrom
feat/span-masking
May 15, 2026
Merged

implemented span masking#3
jsture merged 5 commits into
mainfrom
feat/span-masking

Conversation

@jsture

@jsture jsture commented May 15, 2026

Copy link
Copy Markdown
Contributor

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_weight args (CLI + collator), with validation in both validate_args and __post_init__, and span/hetero_span sampling implemented per-row in Python.
  • Heteroatom detection via a ClassVar regex over APE token strings, weighting span-start sampling for hetero_span.
  • New test module tests/test_span_masking.py covering validation, shape/dtype parity, special/pad invariants, contiguous-run formation, and weight-tensor construction; minor .gitignore tweak.

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.

@jsture
jsture requested a review from Copilot May 15, 2026 18:55
@jsture jsture self-assigned this May 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_weight args (CLI + collator), with validation in both validate_args and __post_init__, and span/hetero_span sampling implemented per-row in Python.
  • Heteroatom detection via a ClassVar regex over APE token strings, weighting span-start sampling for hetero_span.
  • New test module tests/test_span_masking.py covering validation, shape/dtype parity, special/pad invariants, contiguous-run formation, and weight-tensor construction; minor .gitignore tweak.

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.

Comment thread src/modernmolbert/train_selfies_ape_modernbert.py
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py Outdated
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py
Comment thread tests/test_span_masking.py Outdated
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py
Comment thread src/modernmolbert/train_selfies_ape_modernbert.py Outdated
jsture and others added 3 commits May 15, 2026 21:03
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jsture

jsture commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

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_weight` args (CLI + collator), with validation in both `validate_args` and `__post_init__`, and span/hetero_span sampling implemented per-row in Python.

* Heteroatom detection via a `ClassVar` regex over APE token strings, weighting span-start sampling for `hetero_span`.

* New test module `tests/test_span_masking.py` covering validation, shape/dtype parity, special/pad invariants, contiguous-run formation, and weight-tensor construction; minor `.gitignore` tweak.

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.

@jsture
jsture merged commit 869478d into main May 15, 2026
2 checks passed
@jsture
jsture deleted the feat/span-masking branch May 15, 2026 19:21
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