I have a very simple Python script:
import hydra
from omegaconf import DictConfig, OmegaConf
@hydra.main(version_base="1.3", config_path=".", config_name="config")
def main(cfg: DictConfig) -> None:
if cfg.benchmarking.seed_number is None:
raise ValueError()
if __name__ == "__main__":
main()
And here the config file:
benchmarking:
seed_number: None
Unfortunately, the Python script does not raise an error. Instead, when I print the type of cfg.benchmarking.seed_number
, it is str
. How can I pass None
instead?
Try null:
benchmarking:
seed_number: null