hydra_zen.save_as_yaml#

hydra_zen.save_as_yaml(config, f, resolve=False)[source]#

Save a config to a yaml-format file

This is an alias of omegaconf.Omegaconf.save [1].

Parameters:
configAny

A config object.

fstr | pathlib.Path | IO[Any]

The path of the file file, or a file object, to be written to.

resolvebool, optional (default=None)

If True interpolations will be resolved in the config prior to serialization [2]. See Examples section of to_yaml for details.

See also

to_yaml

Serialize a config as a yaml-formatted string.

load_from_yaml

Load a config from a yaml-format file.

References

Examples

>>> from hydra_zen import make_config, save_as_yaml, load_from_yaml

Basic usage

>>> Conf = make_config(a=1, b="foo")
>>> save_as_yaml(Conf, "test.yaml")  # file written to: test.yaml
>>> load_from_yaml("test.yaml")
{'a': 1, 'b': 'foo'}