kd.konfig.mock_modules#
- kauldron.konfig.mock_modules()[source]
Contextmanager which replaces list of modules with ConfigDictProxyObjects.
Meant for updating configs in an interactive environments where with konfig.imports() would be inconvenient, because the modules in question should remain usable and not be globally replaced by ConfigDictProxyObjects.
Example: .. code-block:
from kauldron import kd cfg = ... # import or construct a konfig.ConfigDict instance with kd.konfig.mock_modules(): cfg.losses["l1"] = kd.losses.L1(preds="preds.image", targets="batch.image") # cfg.losses["l1"] is a konfig.ConfigDict rather than a kd.losses.L1 l1 = kd.losses.L1(preds="preds.image", targets="batch.image") # l1 is still a kd.losses.L1 instance
- Yields:
None