Tiny AutoEncoders for diffusion (TAESD family) on Apple MLX.
Project description
mlx-taef
Tiny AutoEncoders for diffusion latents on Apple Silicon, in pure MLX.
mlx-taef is the first MLX port of the TAESD family — TAESD (SD1.x), TAESDXL (SDXL), TAEF1 (FLUX.1), TAEF2 (FLUX.2 Klein) — distilled mini-autoencoders that decode diffusion latents to RGB in milliseconds using a few-MB model instead of multi-GB full VAEs.
Use it for:
- Live previews during long generations on Mac — see each step refresh in <100 ms instead of waiting 30 s for the full VAE.
- Low-memory fallbacks when the full VAE OOMs on 16 GB Macs (TAEF2 peaks at ~1 GB for 1024×1024 vs ~9.6 GB for the full Flux VAE).
- Quick latent inspection in notebooks and ML research.
import mlx.core as mx
from mlx_taef import TAEF2
taef = TAEF2.from_pretrained() # downloads + converts on first call
img = taef.decode(latents) # NHWC float in [0, 1]
img_uint8 = taef.decode_image(latents) # uint8 NHWC ready for PIL
Install
From PyPI:
pip install mlx-taef
# With the mflux preview callback:
pip install "mlx-taef[mflux]"
Or with uv:
uv add mlx-taef
# With mflux:
uv add "mlx-taef[mflux]"
Pin an exact version in a project that needs reproducibility:
pip install "mlx-taef==0.1.0"
Verify the install:
mlx-taef --help
Requires Python ≥ 3.11 and Apple Silicon (mlx itself is Apple-Silicon-only). Runtime install has zero PyTorch dependency — torch is dev-only and used solely for fixture generation in the test suite.
Variants
| Variant | latent_channels | For | HF source |
|---|---|---|---|
TAESD |
4 | Stable Diffusion 1.x | madebyollin/taesd |
TAESDXL |
4 | Stable Diffusion XL | madebyollin/taesdxl |
TAEF1 |
16 | FLUX.1 | madebyollin/taef1 |
TAEF2 |
32 | FLUX.2 Klein | madebyollin/taef2 |
All four share one API.
Benchmarks (M1 Max, fp16)
| Metric | TAEF2 (this library) | Full Flux VAE (reference) | Win |
|---|---|---|---|
| Decode latency 1024×1024 | ~100 ms | seconds | 50–100× |
| Peak unified memory 1024×1024 | ~1 GB | ~9.6 GB | 9.4× |
| Output cosine sim vs PyTorch reference | > 0.999 | — | (parity verified) |
Numbers from tests/test_perf.py on M1 Max 32 GB. See notes/phase1-benchmarks.md for details.
mflux live previews
from mflux.models.flux2 import Flux2Klein
from mlx_taef.integrations.mflux import LivePreviewCallback
model = Flux2Klein.from_pretrained("4bit")
preview = LivePreviewCallback(
variant="taef2",
every=5,
save_to="preview.png",
latent_height=32, # 512 / 16
latent_width=32,
)
model.callbacks.register(preview)
model.generate_image(
prompt="a red apple on a wooden table",
num_inference_steps=25,
width=512,
height=512,
seed=42,
)
For exact value-space recovery, also pass bn_mean=flux2_vae.bn.running_mean, bn_var=flux2_vae.bn.running_var to the callback. Without them, previews show correct structure but colors may shift.
See docs/manual-verification.md for the full verification recipe.
Status
- v0.1.0 — initial public release on PyPI (2026-05-13). All four variants, encoder + decoder, mflux integration, CI, 99 % honest coverage.
Track future releases via the PyPI history or gh release list -R IonDen/mlx-taef.
License
MIT. Mirrors upstream madebyollin/taesd license. Pretrained weights belong to their respective authors (madebyollin).
Acknowledgements
- madebyollin for the upstream TAESD-family models and weights.
- Apple ML Explore for MLX.
- filipstrand/mflux for the MLX-native FLUX runner this library integrates with.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlx_taef-0.1.1.tar.gz.
File metadata
- Download URL: mlx_taef-0.1.1.tar.gz
- Upload date:
- Size: 191.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4639af5114cafdbc19a7ebffe26c88d02b9ef51b59248bfa9dac7841bb54199
|
|
| MD5 |
a657619d6f37a169161069374c025e2a
|
|
| BLAKE2b-256 |
f951b9a3a031c1bca22eb7d88e16d9052d2daa08f53f0546a1677366ebf3c88e
|
Provenance
The following attestation bundles were made for mlx_taef-0.1.1.tar.gz:
Publisher:
release.yml on IonDen/mlx-taef
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlx_taef-0.1.1.tar.gz -
Subject digest:
c4639af5114cafdbc19a7ebffe26c88d02b9ef51b59248bfa9dac7841bb54199 - Sigstore transparency entry: 1525608725
- Sigstore integration time:
-
Permalink:
IonDen/mlx-taef@05a8d6a2dcc9ff42a1edeeddb43b4fd11dcec1b5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/IonDen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05a8d6a2dcc9ff42a1edeeddb43b4fd11dcec1b5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mlx_taef-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mlx_taef-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3983a23fa25ab7e97c906ba9ab74d483e0b22be3ca61737c6fbc9a6df0c7f49
|
|
| MD5 |
88d908a61b2a058cf60f8e557e9e041f
|
|
| BLAKE2b-256 |
772bb6571d9eceecf8856e2a276dce8341395f004f4af4d2981694fe810c1a31
|
Provenance
The following attestation bundles were made for mlx_taef-0.1.1-py3-none-any.whl:
Publisher:
release.yml on IonDen/mlx-taef
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlx_taef-0.1.1-py3-none-any.whl -
Subject digest:
e3983a23fa25ab7e97c906ba9ab74d483e0b22be3ca61737c6fbc9a6df0c7f49 - Sigstore transparency entry: 1525608789
- Sigstore integration time:
-
Permalink:
IonDen/mlx-taef@05a8d6a2dcc9ff42a1edeeddb43b4fd11dcec1b5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/IonDen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05a8d6a2dcc9ff42a1edeeddb43b4fd11dcec1b5 -
Trigger Event:
push
-
Statement type: