You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let each references/*/train.py read its full training configuration from a YAML file (one per task, with a shipped default), keeping the CLI only for overriding individual keys:
A first sketch of the schema, mirroring what the scripts already accept (the six training scripts currently declare 27 to 36 add_argument calls each, most of them shared):
references/common/config.py: load YAML → nested dict → SimpleNamespace/dataclass, apply --set key.path=value overrides (typed from the default), and validate unknown keys.
Each script keeps its main(args) body; only parse_args() changes to build args from the config (a thin compatibility layer can keep the current flat attribute names, e.g. args.lr, so the training loops do not move in the same PR).
Ship configs/default.yaml per task; the README shows the YAML instead of a long command line.
Motivation, pitch
Discussed in #2142 (review by @felixdittrich92): the training scripts keep accumulating CLI flags (--rotation, --eval-straight, --early-stop-*, --amp, now --amp-dtype, --no-hflip, ...), each one needing documentation, and the augmentation pipeline is hard-coded so any change (disable the horizontal flip for semantic region classes, add the new perspective / photo transforms, tune the crop scale) means editing the script. A per-task YAML:
makes a training run reproducible and shareable (the config is the experiment, and it is saved with the checkpoint),
lets users adjust augmentations without patching the scripts,
Keep adding CLI flags (status quo): simplest, but the argument lists are already 27-36 entries per script and augmentation choices stay hard-coded.
Hydra / OmegaConf: powerful, but adds a dependency and its own conventions; a ~100-line loader with --set overrides covers this use case.
Python config modules (config.py per experiment): flexible but not serialisable next to a checkpoint.
Additional context
Happy to implement it in steps once the shape is agreed: (1) loader + detection script, (2) the other five scripts, (3) documentation. The device / AMP unification and the checkpoint metadata from #2142 would then be built on top of the config rather than as more flags.
🚀 The feature
Let each
references/*/train.pyread its full training configuration from a YAML file (one per task, with a shipped default), keeping the CLI only for overriding individual keys:python references/detection/train.py --config references/detection/configs/default.yaml \ --set data.train_path=/data/train data.val_path=/data/val training.epochs=20A first sketch of the schema, mirroring what the scripts already accept (the six training scripts currently declare 27 to 36
add_argumentcalls each, most of them shared):Implementation idea, to keep the diff reviewable:
references/common/config.py: load YAML → nested dict →SimpleNamespace/dataclass, apply--set key.path=valueoverrides (typed from the default), and validate unknown keys.main(args)body; onlyparse_args()changes to buildargsfrom the config (a thin compatibility layer can keep the current flat attribute names, e.g.args.lr, so the training loops do not move in the same PR).<name>.yaml) together with the run metadata, which also covers the "save useful metadata besides the checkpoints" point discussed in [references] Device selection, bfloat16 AMP, checkpoint sidecar and small fixes for the detection and layout training scripts #2142.configs/default.yamlper task; the README shows the YAML instead of a long command line.Motivation, pitch
Discussed in #2142 (review by @felixdittrich92): the training scripts keep accumulating CLI flags (
--rotation,--eval-straight,--early-stop-*,--amp, now--amp-dtype,--no-hflip, ...), each one needing documentation, and the augmentation pipeline is hard-coded so any change (disable the horizontal flip for semantic region classes, add the new perspective / photo transforms, tune the crop scale) means editing the script. A per-task YAML:--no-hflip-style flags altogether.Alternatives
--setoverrides covers this use case.config.pyper experiment): flexible but not serialisable next to a checkpoint.Additional context
Happy to implement it in steps once the shape is agreed: (1) loader + detection script, (2) the other five scripts, (3) documentation. The device / AMP unification and the checkpoint metadata from #2142 would then be built on top of the config rather than as more flags.