Skip to main content

mushin logo

mushin

CI PyPI Latest release Python versions License: MIT DOI

Boilerplate-free, reproducible machine-learning experiment sweeps —
a framework-agnostic sweep engine built on hydra-zen, with first-class PyTorch Lightning integration.

Documentation

Decorate an experiment, sweep over parameters, and get the results back as a labeled xarray.Dataset — not rows in a dashboard you have to export.

  • Boilerplate-free — one decorator, no subclassing or callbacks; results come back as a labeled dataset you can slice and plot.
  • Reproducible — every run captures its config + provenance, sweeps resume durably after a hard kill or cluster preemption, and auto-tuning pins a hardware-independent effective batch size.
  • Scalable — the same task runs in-process, across cores, or on a multi-node SLURM cluster (validated on real GPU hardware); change only the launcher.
  • Framework-agnostic — your task just returns a dict, so scikit-learn, XGBoost, or any Python model works, not only PyTorch.

Quickstart

import mushin


@mushin.sweep
def experiment(lr, seed):
    # ... train a model with this lr/seed, then evaluate it ...
    acc = ...  # your validation accuracy
    return dict(accuracy=acc)  # whatever you return becomes a data variable


ds = experiment.run(
    lr=mushin.multirun([0.01, 0.1, 1.0]),
    seed=mushin.multirun([0, 1, 2]),
)  # 9 runs, returned as a labeled xarray.Dataset
# <xarray.Dataset> Dimensions: (lr: 3, seed: 3)
#   Data variables: accuracy (lr, seed)

ds["accuracy"].mean("seed")  # average over seeds, per learning rate

# Prefer pandas? One call gives a tidy table — no xarray required:
experiment.workflow.to_dataframe()  #    lr  seed  accuracy
# 0  0.01    0      ...

The decorator version above runs as examples/parallel_sweep.py; examples/sweep_to_dataset.py is the same flow written with the class API. Need the full tool (.failures, provenance, custom analysis)? Drop to experiment.workflow, or subclass MultiRunMetricsWorkflow.

Prefer to start from a notebook? There are seven runnable ones, executed in CI so they cannot rot — sweeps → datasets, compare & batteries, studies, resilient sweeps, LLM eval, scikit-learn, and analyzing results.

What else it does

Each links to a guide with a runnable example:

Installation

pip install mushin-py           # the sweep -> dataset core
pip install "mushin-py[eval]"   # + compare, metric batteries, LLM eval, Study

With uv:

uv add mushin-py                # the sweep -> dataset core
uv add "mushin-py[eval]"        # + compare, metric batteries, LLM eval, Study

(uv pip install mushin-py also works outside a uv project.)

The PyPI distribution is mushin-py, but you import mushin — the same pattern as scikit-learn → sklearn.

The core install is the sweep → dataset workflow. The eval extra adds the evaluation layer (compare, the metric batteries, LLM evaluation, Study) and its heavier dependencies (torchmetrics, scipy), keeping the core lean — using those features without it raises a clear install hint. The other extras are viz, netcdf, detection, image, audio, and mcp; the three battery extras pull in eval for you. Combine them with commas — e.g. "mushin-py[eval,viz]", which works verbatim with pip install, uv add, or uv pip install.

Supported Python: 3.10 – 3.14. See the install guide for the full extras table and the platform/torch/NumPy support matrix.

Versioning & scope

mushin follows SemVer with pre-1.0 semantics: a minor bump (0.8 → 0.9) may contain breaking changes, always listed with migration notes in the changelog; patch releases never break. The public API is the top-level mushin namespace plus the documented mushin.benchmark / mushin.llm symbols — underscore modules are internal. The project's scope is deliberately narrow: boilerplate-free, reproducible sweep → dataset, with an optional evaluation layer behind the eval extra. It complements — and does not replace — experiment trackers like W&B or TensorBoard (see the workflows guide for using both together).

Citation

If you use mushin in your research, please cite it (the concept DOI always resolves to the latest release):

@software{martinez_mushin,
  author  = {Martínez-Martínez, Josué},
  title   = {mushin: boilerplate-free, reproducible machine-learning experiment sweeps},
  year    = {2026},
  version = {0.13.0},
  doi     = {10.5281/zenodo.21436444},
  url     = {https://github.com/martinez-hub/mushin}
}

GitHub's "Cite this repository" button (from CITATION.cff) generates this for you.

Contributing

Issues and pull requests are welcome. Local development uses uv:

uv sync
uv run pytest tests/ --hypothesis-profile fast   # tests (DDP test needs >=2 GPUs)
uv run ruff check . && uv run ruff format --check .

Or make check (lint + format + spell + tests, as CI runs). See CONTRIBUTING.md.

Disclaimer

mushin is a maintained, standalone carve-out of the rai_toolbox.mushin subpackage from MIT Lincoln Laboratory's responsible-ai-toolbox (no longer maintained). This is a fork/extraction, not a replacement endorsed by MIT-LL; the original MIT copyright is retained (see LICENSE.txt). The configuration engine it builds on, hydra-zen, is actively maintained by the same group.

Metadata

Release files for mushin-py 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mushin-py 0.13.0
File Size Uploaded
mushin_py-0.13.0.tar.gz 184.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mushin-py 0.13.0
File Interpreter ABI Platform
mushin_py-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 317.0 kB

Release files / mushin_py-0.13.0.tar.gz

Download URL mushin_py-0.13.0.tar.gz
Size 184.7 kB
Tags Source
SHA-256 checksum
How to use checksums
51ed1b1ff85aa59888a515bb3d4ac206611b3ff9f611d4e84abc2d9e06c3ee39
BLAKE2b-256 checksum
How to use checksums
55b4fa9a28bbb3a41353210ebf957ddb314cc2720086e2507aa0235273187086
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release files / mushin_py-0.13.0-py3-none-any.whl

Download URL mushin_py-0.13.0-py3-none-any.whl
Size 132.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a3528fe9e0e2beaddc72c4547bfec87865a7336c8f1936f792b90e4339e6369
BLAKE2b-256 checksum
How to use checksums
f69746713d248cd199fb8ae4d250b176b76b13186cf9100685eabe125a13a36b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.15.1

2 release files

0.15.0

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

This release

0.13.0 This release

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page