使用 Hydra 从 Python 代码可见的 `overrides.yaml` 的路径是什么
What is the path of the `overrides.yaml` visible from Python code with Hydra
代码示例:
@hydra.main(config_path="./configs", config_name='example_01.yaml')
def main(hparams):
# ...
# What is the actual path of the `overrides.yaml` file ???
fn = ''
tracker.log_artifact(fn)
我试过了
def main(hparams):
# ...
p = Path(os.getcwd())
print(p, p.exists())
print([fn for fn in p.glob('**/*')])
p = Path.cwd() / '.hydra/overrides.yaml'
print(p.exists())
输出:
./outputs/2020-07-29/19-35-52 True
[ ]
False
但是脚本完成后,我看到文件存在于目录./outputs/[date]/[time]/.hydra:
config.yaml
hydra.yaml
overrides.yaml
版本:
python: 3.6.9
九头蛇核心:1.0.0rc1
这是 1.0.0rc2 中的错误修正之一。
你应该升级。
您也可以通过 Hydra 配置直接访问此信息:
@hydra.main(config_name="config")
def my_app(_cfg: DictConfig) -> None:
print(HydraConfig.get().overrides.task)
代码示例:
@hydra.main(config_path="./configs", config_name='example_01.yaml')
def main(hparams):
# ...
# What is the actual path of the `overrides.yaml` file ???
fn = ''
tracker.log_artifact(fn)
我试过了
def main(hparams):
# ...
p = Path(os.getcwd())
print(p, p.exists())
print([fn for fn in p.glob('**/*')])
p = Path.cwd() / '.hydra/overrides.yaml'
print(p.exists())
输出:
./outputs/2020-07-29/19-35-52 True
[ ]
False
但是脚本完成后,我看到文件存在于目录./outputs/[date]/[time]/.hydra:
config.yaml
hydra.yaml
overrides.yaml
版本:
python: 3.6.9
九头蛇核心:1.0.0rc1
这是 1.0.0rc2 中的错误修正之一。
你应该升级。
您也可以通过 Hydra 配置直接访问此信息:
@hydra.main(config_name="config")
def my_app(_cfg: DictConfig) -> None:
print(HydraConfig.get().overrides.task)