Configuration filesΒΆ

Frequently we want to store configuration information of our network architecture or other training parameters in configuration files. nuts-ml provides a Config dictionary to simplify this. The following example shows how to create, access and update a configuration dictionary:

>>> from nutsml.config import Config
>>> cfg = Config({'epochs':100, 'layer1':{'stride':2, 'filters':32}})
>>> cfg.epochs
>>> cfg.layer1.filters
>>> cfg.layer1
{'stride':2, 'filters':32}
>>> cfg.layer1.filters = 64
>>> cfg.layer1.filters
>>> cfg.layer2 = Config({'stride':4, 'filters':16})
>>> cfg.layer2.stride

Configuration data can easily be saved and loaded to the file system in JSON or YAML format:

cfg = Config({'epochs':100, 'mode':'TRAIN'})'tests/data/config.yaml')
cfg = Config().load('tests/data/config.json')