Repository navigation
Conversation
…ator Which residues a Koina model can represent depends on the model and on the vocabulary the predictions use, so it is a runtime setting, not a learned parameter. `calibrator.yaml` interpolates the config key into each Koina-backed feature, but `ProbabilityCalibrator.load` rebuilds its features from the saved `config.json`, so on the pretrained path -- the default, and the one the docs describe -- the key has no effect at all. Predictions over a residue set wider than the one the calibrator was fitted on are then sent to Koina regardless, and the server fails the whole request on the first residue it has no embedding for. Apply the override after load, alongside the collision-energy and fragmentation-type overrides that already work this way, and only when it was given explicitly: a saved list is the one that calibrator was fitted with, and replacing it with the shipped default would silently narrow the exclusions for anyone who trained against a wider residue set. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C8sMwNQJTyWwJB5Qn7vjuW
This was referenced Oct 10, 2026
This branch has not been deployed
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.
Fixes #252.
koina.constraints.unsupported_residuesis documented and interpolated into both Koina-backed features bycalibrator.yaml, butProbabilityCalibrator.load()rebuilds its features from the savedconfig.jsonrather than from Hydra. On the pretrained path — the default, and the one the docs describe — the key is parsed and then discarded, and the shipped three-entry default applies no matter what you pass.That matters because a residue Prosit has no embedding for fails the entire Koina request server-side, not just that peptide. Scoring predictions from a checkpoint whose vocabulary is wider than the calibrator's is therefore impossible to configure around.
Approach
Apply the override after load, alongside the collision-energy and fragmentation-type overrides that already work exactly this way via
apply_koina_model_input_overrides.It applies only when explicitly given, detected with the existing
hydra_override_keyshelper, the same wayuser_specified_columndistinguishes a deliberate setting from a shipped default. A saved list is the one that calibrator was fitted with; replacing it unconditionally with the shipped default would silently narrow the exclusions for anyone who trained against a wider residue set. So there is no behaviour change unless you ask for one.Changes
ProbabilityCalibrator.apply_unsupported_residues_override()— sets the list on every feature that filters by one, returns their names.Noneis a no-op; an empty list is honoured as a deliberate "exclude nothing".apply_koina_intensity_config()— takeshydra_overrides, parseskoina.constraints.unsupported_residues, applies it when overridden, and logs what changed.main.py— passes the overrides it already has through to the apply step.Verification
Against the real published
InstaDeepAI/winnow-general-model:End to end on real data — a 133-residue InstaNovo checkpoint's predictions over 8,853 bovine whey spectra, with a 41-residue exclusion list — the Koina stage now reports the list it was given and completes:
The same inputs on
mainfail withInferenceServerException: At least one request failed, preceded byKeyErrorfor residues that were in the list passed.8 new tests (4 on the calibrator method, 4 on the config layer); 684 pass, no regressions. All pre-commit hooks pass.
Not covered here
With the Koina stage passing, that run then fails further downstream in
Mass Error (Da)—mass_error.py:44does a bareresidue_masses[residue]lookup against a 68-entry table and raisesKeyError: 'W[UNIMOD:35]'. Separate issue, same family as #251; happy to file it.🤖 Generated with Claude Code
https://claude.ai/code/session_01C8sMwNQJTyWwJB5Qn7vjuW