-
i want to realize like this
how to do ? |
Beta Was this translation helpful? Give feedback.
Answered by
Jasha10
Nov 20, 2021
Replies: 1 comment 1 reply
-
Hi @jaffe-fly, I'd recommend using an OmegaConf custom resolver. import os
from omegaconf import OmegaConf
OmegaConf.register_new_resolver("os_cpu_count", lambda: os.cpu_count())
my_yaml = """
trainer:
cpu_count: ${os_cpu_count:}
"""
cfg = OmegaConf.create(my_yaml)
expected = os.cpu_count()
assert cfg.trainer.cpu_count == expected |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jaffe-fly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @jaffe-fly, I'd recommend using an OmegaConf custom resolver.