Define Python objects in YAML. Reference, compose, and instantiate them effortlessly.
pip install sparkwheel# config.yaml
dataset:
num_classes: 10
batch_size: 32
model:
_target_: torch.nn.Linear
in_features: 784
out_features: "%dataset::num_classes" # Reference
training:
steps_per_epoch: "$10000 // @dataset::batch_size" # Expressionfrom sparkwheel import Config
config = Config()
config.update("config.yaml")
model = config.resolve("model") # Actual torch.nn.Linear(784, 10)- Declarative Objects - Instantiate any Python class with
_target_ - Smart References -
@for resolved values,%for raw YAML - Composition by Default - Dicts merge, lists extend automatically
- Explicit Control -
=to replace,~to delete - Python Expressions - Dynamic values with
$ - Schema Validation - Type-check with dataclasses
Get Started · Documentation · Quick Reference
Sparkwheel is a hard fork of MONAI Bundle's config system, with the goal of making a more general-purpose configuration library for Python projects. It combines the best of MONAI Bundle and Hydra/OmegaConf, while introducing new features and improvements not found in either.
