Skip to main content

Tiny AutoEncoders for diffusion (TAESD family) on Apple MLX.

Project description

mlx-taef

PyPI version Python versions License: MIT

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 dependencytorch 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_taef-0.1.1.tar.gz (191.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_taef-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

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

Hashes for mlx_taef-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c4639af5114cafdbc19a7ebffe26c88d02b9ef51b59248bfa9dac7841bb54199
MD5 a657619d6f37a169161069374c025e2a
BLAKE2b-256 f951b9a3a031c1bca22eb7d88e16d9052d2daa08f53f0546a1677366ebf3c88e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_taef-0.1.1.tar.gz:

Publisher: release.yml on IonDen/mlx-taef

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for mlx_taef-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3983a23fa25ab7e97c906ba9ab74d483e0b22be3ca61737c6fbc9a6df0c7f49
MD5 88d908a61b2a058cf60f8e557e9e041f
BLAKE2b-256 772bb6571d9eceecf8856e2a276dce8341395f004f4af4d2981694fe810c1a31

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_taef-0.1.1-py3-none-any.whl:

Publisher: release.yml on IonDen/mlx-taef

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page