Getting Started
Getting Started
Prerequisites: Python 3.12+. PyTorch is optional, required only for examples that import
torch.nn.
Install
pip install laco
# Optional: with wandb integration
pip install "laco[wandb]"
Five-Minute Example
1. Write a config file
# configs/mlp.py
import laco.language as L
import torch.nn as nn
model = L.call(nn.Sequential)(
L.call(nn.Linear)(in_features=784, out_features=256),
L.call(nn.ReLU)(),
L.call(nn.Linear)(in_features=256, out_features=10),
)
2. Load and inspect
import laco
cfg = laco.load("configs/mlp.py")
print(laco.dump(cfg)) # prints Hydra-compatible YAML
3. Instantiate
model = laco.instantiate(cfg.model)
# model is now a real nn.Sequential
print(type(model)) # <class 'torch.nn.modules.container.Sequential'>
4. Apply overrides
cfg = laco.load("configs/mlp.py?model.0.out_features=512")
Or from the CLI:
laco compose configs/mlp.py model.0.out_features=512
Next Steps
- Work through the tutorials: notebooks/tutorials/
- Understand the lie-typing contract
- See full examples in examples/foundations.md
- Browse the API reference