Repository navigation
feat: release the paper models on the Hugging Face Hub - #4
Merged
Merged
Conversation
from_pretrained downloads the weights (or reads a local copy of the release), checks their SHA-256 checksum, applies the saved training settings and checks the input dimensions. predict and score_variants now cover every requested gene in the local input data, not only the benchmark genes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Released weights (
c512526)varformer/checkpoints.py: newload_released(model, seed, repo_id, revision, local_dir). It downloads<model>/seed<N>.safetensorsand<model>/seed<N>.jsonfrom the Hub (or reads a local copy of the release), checks the SHA-256 checksum of the weights, and remaps the state dict.seed="best"selects the seed with the highest validation Spearman correlation fromindex.json.afr,amr,nfe,sas(gene models of the paper, withoutgeneticConstraint) andsas-gnh(SAS models used for the Genes & Health variant analyses, withgeneticConstraint). Five seeds each.Varformer.from_pretrained(model, seed=42, repo_id=None, revision=None, local_dir=None)now loads these released models. It applies the saved training settings, checks that the local input dimensions match the released model, and stops if the weights lack model keys. Models that users train themselves still load withfrom_checkpoint.huggingface-hub>=0.24,safetensors>=0.4(lock file updated; no existing versions changed).predictandscore_variantscover every geneBefore this change,
predictandscore_variantsran only over the benchmark loaders (Pfam, Recently Approved and Pharos test genes) and silently skipped every other gene. They now build a loader for the requested genes from the local input data (ModelPreprocessorInference.create_gene_loader).evaluatekeeps the benchmark loaders.README (
bde002b)Checks
pytest: 91 passed, 1 skipped. New tests:tests/test_released.py(seed selection, remapping, checksum,sas-gnh),test_gene_loader_keeps_requested_genes_present_in_all_modalities.ruff check varformer testspasses.local_dir): NFE seed 23 and SAS seed 13 return all 2,000 sampled genes, and the predictions match the paper's genome scores (maximum absolute difference 1.2e-6).sas-gnhseed 42 loads withgeneticConstraintand scores 531 variants in LDLR.seed="best"works.Before merging
aaronw1290/Varformer(HUB_REPO_IDand the README links) must exist and be public.