Skip to content

Examples

Every example below is a runnable script in the examples/ directory — CI-tested, except the multi-GPU scaling examples (which need real GPUs, so they run on a cluster rather than in CI). The guides embed pieces of them; this page indexes them all. Clone the repo and run any one with:

uv run python examples/<name>.py

Some examples need the eval extra

The comparison/Study/battery/LLM examples (compare_classifiers, study_mnist, segmentation_demo, compare_llms_demo, batteries) use mushin's optional evaluation layer. On a plain pip install mushin-py they raise an install hint — run them with pip install "mushin-py[eval]" (uv run in this repo already includes it). batteries.py additionally wants the detection/image/audio extras for those batteries.

Sweeps → datasets

Example What it shows
sweep_to_dataset.py The flagship flow: define task(...), sweep with multirun, get results back as a labeled xarray.Dataset.
sklearn_sweep.py The sweep layer is framework-agnostic — a scikit-learn LogisticRegression sweep (no torch) still returns a labeled dataset.
parallel_sweep.py Submit a sweep out-of-processrun(..., launcher="joblib") runs cells across worker processes (needs hydra-joblib-launcher); the docstring shows the submitit/SLURM variant.

Compare & Study, with statistics

Example What it shows
compare_classifiers.py compare(...) two classifiers across seeds on MNIST with significance (BenchmarkResult).
study_mnist.py Study — a multi-seed training sweep routed straight into compare, in one call.
segmentation_demo.py compare(task="segmentation") on synthetic masks (mIoU, Dice, …).
compare_llms_demo.py llm.compare_llms — compare LLM systems across reproducible seeds with significance.

Benchmark batteries

Example What it shows
batteries.py A runnable toy for all 7 built-in batteries (classification, segmentation, detection, regression, retrieval, image_quality, audio).

For the full per-battery walkthrough — real-model recipes (SAM 3.1, YOLO-World, CLIP, …) alongside each of these toys — see the Built-in batteries guide.

Scaling across GPUs & nodes

These need real multi-GPU / multi-node hardware, so they run on a cluster rather than in CI. See the linked guides for the full recipe and validation runbook.

Example What it shows
gpu_packing.py Pack several small sweep jobs onto each GPU with pin_gpu_round_robin (needs ≥2 GPUs + hydra-joblib-launcher). See the GPU packing guide.
multinode_ddp.py Multi-node DDP with HydraDDP + submitit_slurm_config — one process per GPU across SLURM nodes, with a fail-fast world-size guard. See the Multi-node training guide.
sharding_fsdp_multirun.py Shard one model across GPUs with HydraFSDP under a Hydra --multirun sweep (needs ≥2 GPUs). See the Sharded training guide.

See also

  • Quickstart — the flagship example, run end-to-end.
  • Guides — workflows, compare, Study, resilience, and more.