Skip to content

Configuration

SafeTuneConfig is the shared configuration object behind the CLI's --config flag and the YAML workflow. Load it from YAML or build it in Python; every field maps to a CLI flag, and explicit CLI flags override config values.

from safetune.config import SafeTuneConfig

cfg = SafeTuneConfig.from_yaml("run.yaml")

See the CLI Reference for the YAML schema and precedence rules.

Reference

safetune.config.SafeTuneConfig dataclass

Declarative config for a safetune run.

from_yaml(path) classmethod

Load a SafeTuneConfig from a YAML file.

Unknown keys are collected into method_kwargs and forwarded to the trainer, so method-specific hyperparameters need no special handling.

to_namespace()

Return an argparse.Namespace with all fields, including method_kwargs.

as_trainer_kwargs()

Return a dict suitable for passing as **kwargs to any Trainer constructor.