mapping_networks.config.load_config

mapping_networks.config.load_config(source: str | Path | dict[str, Any]) MappingConfig

Load a MappingConfig from a YAML file path or Python dict.

Parameters:

source – A file path (str or Path) to a YAML file, or a Python dict.

Returns:

A validated MappingConfig instance.

Raises:
  • FileNotFoundError – If a file path is given and the file does not exist.

  • pydantic.ValidationError – If the data fails validation (including unknown keys due to extra="forbid").

Example:

# From a Python dict
config = load_config({"generator": {"latent_dim": 64}})

# From a YAML file
config = load_config("config.yaml")