Replies: 1 comment 1 reply
-
Hi @nghorbani, You can try deleting the field from the config before saving it. >>> cfg = OmegaConf.create({"a": 1, "b": 2, "c": 3}) # create a new config
>>> print(cfg)
{'a': 1, 'b': 2, 'c': 3}
>>> from copy import deepcopy
>>> cfg2 = deepcopy(cfg) # make a copy of the config
>>> del cfg2["c"] # delete a field from the copy
>>> print(cfg2)
{'a': 1, 'b': 2}
>>> OmegaConf.to_yaml(cfg2)
'a: 1\nb: 2\n'
>>> print(cfg) # the original config still has the "c" field
{'a': 1, 'b': 2, 'c': 3} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wonder if it is possible to leave out a certain field when saving yaml configuration to a file?
Beta Was this translation helpful? Give feedback.
All reactions