A Python machine learning toolkit. Requires Python ≥ 3.12.
Docs: pymlkit.zerodtree.com
uv add git+https://github.com/zeroDtree/mlkitWith optional dependencies:
uv add "git+https://github.com/zeroDtree/mlkit[hard]"hard: flash-attn, bitsandbytes (CUDA / quantization)
Other install options
Editable (local clone):
git clone git@github.com:zeroDtree/mlkit.git
uv add --editable mlkitpip:
pip install "mlkit @ git+https://github.com/zeroDtree/mlkit.git"
# with optional deps:
pip install "mlkit[hard] @ git+https://github.com/zeroDtree/mlkit.git"git clone https://github.com/zeroDtree/mlkit.git
cd mlkitSee the example/ directory for usage by task.
Each example is driven by Hydra. Checkpoints, logs, the MLflow database, and Hydra output are relative paths under artifacts/ in the directory you start from. A run started in the example directory does not resume a run started at the repo root.
From the example directory:
cd example/butterfly_edm
uv run python main.py # default config
uv run python main.py train.lr=1e-3 # override a single value
uv run python main.py --multirun gm.n_discretization_steps=100,200 # sweep
uv run python infer.py # sample from the latest checkpoint
uv run python infer.py train.lr=1e-3 # same overrides as the training runFrom the repo root, the same script writes to <repo>/artifacts/ instead:
uv run python example/butterfly_edm/main.py
uv run python example/butterfly_edm/infer.py
bash scripts/mc-run-python.sh example/butterfly_edm/main.pyConfig defaults live in the config.yaml (or config_<variant>.yaml) next to each script. Each training script main*.py has an inference script infer*.py that shares its config and loads its latest checkpoint; set infer.checkpoint_dir to pick another one.
uv sync
# optional extras for CUDA tooling:
uv sync --extra hard
uv run nbstripout --install --attributes .gitattributesuv sync installs package dependencies plus the dev group (lint, docs, notebooks).
nbstripout strips notebook cell outputs on commit. Run --install once per clone.
Verify with uv run nbstripout --status.
uv run ruff check
uv run ty check
uv run pytestRun launchers from the repository root with bash scripts/.... See scripts/README.md.
uv run mkdocs serve
# or on a custom address:
uv run mkdocs serve --dev-addr 127.0.0.1:8080