mlx-diffuser
Diffusion & flow models on Apple silicon, powered by MLX. Train from scratch, fine-tune, or run inference — for image, video, and discrete modalities — from one small, readable codebase.
If you know PyTorch and 🤗 diffusers, you already know this library:
Model.from_pretrained(...), pipe(...), nn.Module everywhere. The difference
is underneath — unified memory, mx.compile, fused Metal kernels, and built-in
weight quantization, so large models fit and run fast on a Mac.
Install
pip install mlx-diffuser # core
pip install "mlx-diffuser[hub]" # + Hugging Face Hub loading
Requires Apple silicon (M-series) and Python 3.11+.
Generate
from mlx_diffuser import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("path/or/hub-id", dtype="bf16", quantize=4)
images = pipe([1, 2, 3], num_inference_steps=50, guidance_scale=4.0, seed=0)
…or from the terminal:
mlx-diffuser generate path/or/hub-id --labels 1,2,3 --steps 50 --out samples/
Train from scratch
from mlx_diffuser import DiT, DiTConfig, DiffusionTrainer
from mlx_diffuser.schedulers import FlowMatchEulerScheduler
from mlx_diffuser.training import batch_iterator
model = DiT(DiTConfig(in_channels=3, hidden_size=384, depth=12, num_heads=6))
trainer = DiffusionTrainer(model, FlowMatchEulerScheduler(), lr=1e-4, ema_decay=0.999)
trainer.fit(batch_iterator(data, batch_size=32), steps=10_000)
model.save_pretrained("my-model")
Fine-tune with LoRA (on your laptop)
from mlx_diffuser import DiT, inject_lora, save_lora
from mlx_diffuser.schedulers import FlowMatchEulerScheduler
from mlx_diffuser import DiffusionTrainer
model = DiT.from_pretrained("my-model")
inject_lora(model, rank=8) # base frozen; only adapters train
trainer = DiffusionTrainer(model, FlowMatchEulerScheduler(), lr=5e-3)
trainer.fit(batch_iterator(data, batch_size=8), steps=1000)
save_lora(model, "my-lora", rank=8, alpha=16)
mlx-diffuser train --data ./photos --base my-model --lora --out my-lora --steps 1000
What's inside
- Models —
DiT(image/video/text via config),UNet2D(Stable-Diffusion style, text-conditionable),AutoencoderKL(VAE for latent diffusion). - Schedulers —
DDPM,DDIM,EulerDiscrete,FlowMatchEuler; one object covers both training (add_noise/get_target) and sampling (step). - Training —
DiffusionTrainer(compiled step, EMA, grad clip, min-SNR weighting), full fine-tune, and LoRA. - Apple-silicon speed — fused attention,
mx.compile, lazy evaluation, unified-memory controls, and 4/8-bit weight quantization. - CLI —
generate,train,convert.
Design
The library rests on three orthogonal pieces — a process (the noise/flow math),
a network (a plain nn.Module), and a pipeline (inference glue). Keeping
them independent is what lets the same network train under DDPM today and
flow-matching tomorrow. See DESIGN.md and the
documentation.
License
Apache-2.0.
Metadata
Release files for mlx-diffuser 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mlx_diffuser-0.1.1.tar.gz | 123.5 kB | With provenance | Details for mlx_diffuser-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mlx_diffuser-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mlx_diffuser-0.1.1-py3-none-any.whl |
Total release size: 170.2 kB
Release files / mlx_diffuser-0.1.1.tar.gz
| Download URL | mlx_diffuser-0.1.1.tar.gz |
|---|---|
| Size | 123.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
660faf8a3ff9664ac6b26974a35eb8728dc1656461a3712256689ba2d7965c48
|
|
BLAKE2b-256 checksum How to use checksums |
546781ad59da52723fbc5a986a212729ec5d739ac25c130843ab9571708e71de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 15, 2026.
Transparency logRelease files / mlx_diffuser-0.1.1-py3-none-any.whl
| Download URL | mlx_diffuser-0.1.1-py3-none-any.whl |
|---|---|
| Size | 46.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9f3281ddda49f9e4c616f16b06b05357030b0083171dc2ef36228729f3971a7
|
|
BLAKE2b-256 checksum How to use checksums |
b4eeac143b73f83a3d047a159738257664c93bf89f11f926c30b5556255be078
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 15, 2026.
Transparency logSecurity for mlx-diffuser 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mlx_diffuser-0.1.1.tar.gz
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 Jun 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.