Override Configs
Override Configs
See also: API: laco.load, Concepts: Interpolation
URL Query Syntax
Append ?key=value pairs to the path when calling laco.load:
cfg = laco.load("configs/train.py?lr=5e-4&model.out_features=512")
Multiple keys are separated by &. Values are coerced to the field's
declared type when the field is part of a @L.config schema.
Positional Overrides
Pass override strings as positional arguments:
cfg = laco.load("configs/train.py", "lr=5e-4", "model.out_features=512")
Equivalent to the URL form; useful when constructing overrides programmatically.
Fragment Selector
Select a sub-tree of the config with #key.nested:
model_cfg = laco.load("configs/train.py#model")
# model_cfg is the DictConfig subtree at cfg.model
Override Grammar
| Syntax | Effect |
|---|---|
key=value | Set key to value |
+key=value | Append value to list at key |
~key | Delete key from the config |
key=null | Set key to None |
Type Coercion
Values are parsed as:
true/false→bool- Integer strings →
int - Float strings →
float [a,b,c]→ list- Everything else →
str
When the target field is typed (@L.config), the coerced value is validated
against the declared type. A mismatch raises ValidationError.
CLI Overrides
laco compose configs/train.py lr=5e-4 model.out_features=512
laco run configs/train.py optimizer=adam
The CLI passes override strings directly to apply_overrides.