mml.core.scripts.pipeline_configuration
- class PipelineCfg[source]
Bases:
object- __init__(pipeline_cfg: DictConfig, restrict_keys: List[str] | None = None) None[source]
PipelineCfg holds relevant configuration elements of a training pipeline to store, reproduce and leverage knowledge at a later point. The intended usage is by invoking
from_cfg()on the full mml config, which will produce a masked copy only focussing on a subset of config keys.- Parameters:
pipeline_cfg (DictConfig) – a config
restrict_keys (Optional[List[str]]) – which config keys to focus upon
- activate(current_cfg: DictConfig) None[source]
To be used as a config manager, activates this pipeline upon the currently active mml config. When the context exits, the original configuration is restored.
- Parameters:
current_cfg (DictConfig) – the currently active mml config
- Returns:
no return value, the mml config is modified in place
- clone() PipelineCfg[source]
Convenience method to deepcopy the configuration.
- Returns:
a deepcopy of the configuration
- classmethod from_cfg(current_cfg: DictConfig, restrict_keys: List[str] | None = None) PipelineCfg[source]
Extracts relevant pipeline keys from current config determined by restrict_keys.
- Parameters:
current_cfg (DictConfig) – the FULL config to derive the pipeline configuration from
restrict_keys (Optional[List[str]]) – which config keys to focus upon
- Returns:
- classmethod load(path: Path, pipeline_keys: List[str] | None = None) PipelineCfg[source]
Load a stores pipeline configuration (or blueprint) from path.
- Parameters:
path (Path) – the path to the stored file
pipeline_keys (Optional[List[str]]) – which config keys to focus upon
- Returns:
the loaded pipeline configuration (restricted to provided pipeline keys)
- store(task_struct: TaskStruct, as_blueprint: bool = False) Path[source]
Store this pipeline. Requires a task struct to determine task name. If blueprint is set, this will be stored in the BLUEPRINTS folder instead of PIPELINES. This allows for easier re-usage.
- Parameters:
task_struct (TaskStruct) – struct of the task this pipeline has or should be applied upon
as_blueprint (bool) – if true store as blueprint otherwise as pipeline
- Returns:
the path to the stored file