Repository navigation
fix(rfd3,rf3): resolve Hydra configs next to the inference scripts - #416
Open
CloudCorpRecords wants to merge 1 commit into
Open
CloudCorpRecords wants to merge 1 commit into
CloudCorpRecords wants to merge 1 commit into
Conversation
The wheel force-includes each model's configs inside its own package (pyproject.toml: "models/rfd3/configs" = "rfd3/configs", "models/rf3/configs" = "rf3/configs"), but run_inference.py and inference.py searched three directories above __file__, so pip-installed inference failed with "Primary config directory not found". Resolve the configs directory relative to __file__ itself, as suggested in RosettaCommons#403. Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
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 #403.
Problem
models/rfd3/src/rfd3/run_inference.pyandmodels/rf3/src/rf3/inference.pycomputed the Hydra config directory as three directories above__file__:But the wheel bundles each model's configs inside its own package —
pyproject.toml([tool.hatch.build.targets.wheel.force-include]):So in an installed package the scripts looked for e.g.
.../lib/python3.12/configsinstead of.../site-packages/rfd3/configs, and inference died with "Primary config directory not found".Fix
Exactly the change suggested in #403, applied at the scripts' current locations (both files, one line each):
Verification
CONTRIBUTING notes that running the repo test suite is "not currently supported", so I verified with a standalone script instead. It rebuilds the installed layout from the wheel force-include map (
site-packages/rfd3/run_inference.pynext tosite-packages/rfd3/configs/, same forrf3), extracts each script's real_config_pathexpression via AST, evaluates it with__file__bound to the simulated installed location, and asserts the result is a directory containinginference.yaml(theconfig_nameboth scripts pass to@hydra.main), using the repo's realconfigs/inference.yamlfiles:<site-packages>/../configs(i.e.<sim>/configs) —is_dir=False→ FAIL, reproducing the bug.<site-packages>/rfd3/configs/<site-packages>/rf3/configs—is_dir=True,inference.yamlpresent → PASS.python -m py_compile.Note:
models/rfd3na/src/rfd3na/run_inference.pycontains the same pattern; it is outside the scope of #403, so I left it untouched — flagging it here in case maintainers want a follow-up.Disclosure: this change was prepared with AI assistance; the fix itself is the one-line change proposed in the issue.