Не могли бы вы мне помочь?
- минимальный код, показывающий мою ошибку.
import hydra
from hydra.core.utils import setup_globals
from hydra.utils import get_original_cwd
from omegaconf import OmegaConf
with hydra.initialize(config_path="conf", version_base=None):
cfg = hydra.compose(config_name="try_config")
print(OmegaConf.to_yaml(cfg))
# reinitialize hydra
setup_globals()
output_dir = get_original_cwd() # ValueError: get_original_cwd() must only be used after HydraConfig is initialized
os.makedirs(output_dir, exist_ok=True)
with open(os.path.join(output_dir, "result.txt"), "w") as f:
f.write("Test")
- Ошибка
ValueError: get_original_cwd() must only be used after HydraConfig is initialized - try_config.yaml
b: 2
hydra:
run:
dir: "outputs"
Подробнее здесь: https://stackoverflow.com/questions/784 ... e-of-i-thi