Skip to content
zeroDtreePublic

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

mlkit

A Python machine learning toolkit. Requires Python ≥ 3.12.

Docs: pymlkit.zerodtree.com

Installation

uv (recommended)

uv add git+https://github.com/zeroDtree/mlkit

With 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 mlkit

pip:

pip install "mlkit @ git+https://github.com/zeroDtree/mlkit.git"
# with optional deps:
pip install "mlkit[hard] @ git+https://github.com/zeroDtree/mlkit.git"

Examples

git clone https://github.com/zeroDtree/mlkit.git
cd mlkit

See 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 run

From 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.py

Config 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.

Development

uv sync
# optional extras for CUDA tooling:
uv sync --extra hard
uv run nbstripout --install --attributes .gitattributes

uv 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 pytest

Run launchers from the repository root with bash scripts/.... See scripts/README.md.

Docs

uv run mkdocs serve
# or on a custom address:
uv run mkdocs serve --dev-addr 127.0.0.1:8080

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages