Skip to content

fix(rfd3,rf3): resolve Hydra configs next to the inference scripts - #416

Open
CloudCorpRecords wants to merge 1 commit into
RosettaCommons:productionfrom
CloudCorpRecords:fix-403-config-path
Open

CloudCorpRecords wants to merge 1 commit into
RosettaCommons:productionfrom
CloudCorpRecords:fix-403-config-path

Conversation

@CloudCorpRecords

Copy link
Copy Markdown

Fixes #403.

Problem

models/rfd3/src/rfd3/run_inference.py and models/rf3/src/rf3/inference.py computed the Hydra config directory as three directories above __file__:

_config_path = os.path.join(
    os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "configs"
)

But the wheel bundles each model's configs inside its own package — pyproject.toml ([tool.hatch.build.targets.wheel.force-include]):

"models/rfd3/configs" = "rfd3/configs"
"models/rf3/configs"  = "rf3/configs"

So in an installed package the scripts looked for e.g. .../lib/python3.12/configs instead 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):

_config_path = os.path.join(os.path.dirname(__file__), "configs")

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.py next to site-packages/rfd3/configs/, same for rf3), extracts each script's real _config_path expression via AST, evaluates it with __file__ bound to the simulated installed location, and asserts the result is a directory containing inference.yaml (the config_name both scripts pass to @hydra.main), using the repo's real configs/inference.yaml files:

  • Before the fix (both models): computed path = <site-packages>/../configs (i.e. <sim>/configs) — is_dir=False → FAIL, reproducing the bug.
  • After the fix (both models): computed path = <site-packages>/rfd3/configs / <site-packages>/rf3/configs — is_dir=True, inference.yaml present → PASS.
  • Both edited files also pass python -m py_compile.

Note: models/rfd3na/src/rfd3na/run_inference.py contains 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.

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

No deployments
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.

[BUG] RFD3 and RF3 hydra configs path search doesn't match distribution

1 participant