feat: add input validation for early error detection#446
Open
haoyu-haoyu wants to merge 1 commit intoRosettaCommons:mainfrom
Open
feat: add input validation for early error detection#446haoyu-haoyu wants to merge 1 commit intoRosettaCommons:mainfrom
haoyu-haoyu wants to merge 1 commit intoRosettaCommons:mainfrom
Conversation
Add rfdiffusion/validation.py with validators for: - PDB file existence and ATOM record format - Contig string syntax (ranges, chain-residue specs) - Model checkpoint existence - Hotspot residue format (chain letter + number) - Diffuser config parameters (T, partial_T bounds) Validators are called in Sampler.initialize() and sample_init(), before GPU allocation and model loading, so users get clear error messages instead of cryptic tensor shape mismatches.
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.
Summary
rfdiffusion/validation.pywith validators for PDB files, contig strings, checkpoint paths, hotspot residues, and diffuser configSampler.initialize()andsample_init(), before GPU allocation and model loadingCurrently, invalid inputs (missing PDB, malformed contigs, bad hotspot format) produce cryptic errors deep in tensor operations after the model is already loaded on GPU. This PR catches these errors early with clear, actionable messages.
Validators
validate_pdb_path()validate_contig_string()10-20, chain specsA5-50, no negatives, start ≤ endvalidate_checkpoint_path()validate_hotspot_res()A50(chain letter + integer)validate_diffuser_config()T ≥ 1,partial_T ≤ TExample error messages
Test plan
ValidationErrorbefore model loading