Reputation: 403
I want to define project root path in Hydra config file without hardcoding it. 'til now couldn't find any feature of Hydra that can imply the path!
E.g., suppose we have the following project structure:
project-name
├── conf
│ ├── config.yaml
│ ├── config.py
├── src
│ ├── model.py
Now I want to define the project path in config.yaml
up to project-name
. For example project_path: C:\\Projects\\project-name
. However, instead of hardcoding C:\\Projects\\
, I want Hydra to figure out for me what the preceding path is up to and including project-name
.
With python I can do something in config.py
like:
str(Path(__file__).parent.parent.absolute())
However, I want to get rid of config.py
, and do all the configurations in config.yaml
Any ideas?
Upvotes: 1
Views: 1067
Reputation: 33646
This is not supported by Hydra. The concept of a root directory is not defined well enough. You can use OmegaConf custom resolvers to implement your on logic on a specific node but it's not clear to me how you can achieve what you are trying to do in a clean and reusable way.
Upvotes: 1