mlx-taef 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mlx_taef-0.1.0/.gitignore +18 -0
- mlx_taef-0.1.0/CHANGELOG.md +37 -0
- mlx_taef-0.1.0/PKG-INFO +125 -0
- mlx_taef-0.1.0/README.md +92 -0
- mlx_taef-0.1.0/docs/manual-verification.md +54 -0
- mlx_taef-0.1.0/pyproject.toml +176 -0
- mlx_taef-0.1.0/src/mlx_taef/__init__.py +9 -0
- mlx_taef-0.1.0/src/mlx_taef/_version.py +24 -0
- mlx_taef-0.1.0/src/mlx_taef/api.py +204 -0
- mlx_taef-0.1.0/src/mlx_taef/cli.py +92 -0
- mlx_taef-0.1.0/src/mlx_taef/convert.py +201 -0
- mlx_taef-0.1.0/src/mlx_taef/download.py +45 -0
- mlx_taef-0.1.0/src/mlx_taef/integrations/__init__.py +1 -0
- mlx_taef-0.1.0/src/mlx_taef/integrations/mflux.py +168 -0
- mlx_taef-0.1.0/src/mlx_taef/model.py +197 -0
- mlx_taef-0.1.0/src/mlx_taef/py.typed +0 -0
- mlx_taef-0.1.0/src/mlx_taef/variants.py +115 -0
- mlx_taef-0.1.0/tests/__init__.py +0 -0
- mlx_taef-0.1.0/tests/conftest.py +20 -0
- mlx_taef-0.1.0/tests/generate_references.py +134 -0
- mlx_taef-0.1.0/tests/test_api.py +98 -0
- mlx_taef-0.1.0/tests/test_cli.py +57 -0
- mlx_taef-0.1.0/tests/test_convert.py +153 -0
- mlx_taef-0.1.0/tests/test_decoder.py +55 -0
- mlx_taef-0.1.0/tests/test_download.py +88 -0
- mlx_taef-0.1.0/tests/test_encoder.py +71 -0
- mlx_taef-0.1.0/tests/test_integrations_mflux.py +89 -0
- mlx_taef-0.1.0/tests/test_model_layers.py +285 -0
- mlx_taef-0.1.0/tests/test_perf.py +53 -0
- mlx_taef-0.1.0/tests/test_properties.py +85 -0
- mlx_taef-0.1.0/tests/test_variants.py +52 -0
- mlx_taef-0.1.0/uv.lock +3024 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.mypy_cache/
|
|
6
|
+
.ruff_cache/
|
|
7
|
+
.coverage
|
|
8
|
+
.coverage.*
|
|
9
|
+
htmlcov/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
.DS_Store
|
|
14
|
+
tests/reference/*.pth
|
|
15
|
+
tests/reference/*.pt
|
|
16
|
+
|
|
17
|
+
# hatch-vcs auto-generated
|
|
18
|
+
src/mlx_taef/_version.py
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — 2026-05-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Public release of `mlx-taef`.
|
|
12
|
+
- Pure MLX implementation of the TAESD family architecture: `Clamp`, `Block` (with optional `midblock_gn` pool branch using `pytorch_compatible=True` GroupNorm), `make_decoder`, `make_encoder`.
|
|
13
|
+
- Four variants under one consistent API: `TAESD`, `TAESDXL`, `TAEF1`, `TAEF2`.
|
|
14
|
+
- `Taef.from_pretrained()` — auto-download from HF Hub, convert to MLX, cache at `~/.cache/mlx-taef/`. Zero PyTorch dependency at runtime.
|
|
15
|
+
- `Taef.from_pretrained_local()` — load from already-converted local safetensors.
|
|
16
|
+
- `Taef.decode()` / `decode_image()` / `encode()` / `scale_latents()` / `unscale_latents()`.
|
|
17
|
+
- Weight conversion handling both upstream-Sequential and Diffusers key formats (with the +1 decoder index offset for Diffusers).
|
|
18
|
+
- CLI: `mlx-taef convert --variant <name> --role {decoder,encoder} --dst <path>`, `info <path>`, `bench --variant <name>`.
|
|
19
|
+
- `mlx_taef.integrations.mflux.LivePreviewCallback` for live previews during FLUX.1 / FLUX.2 Klein generation in mflux.
|
|
20
|
+
- `mlx_taef.integrations.mflux.unpack_flux2_latent` helper handling mflux's packed DiT latent layout + optional BN denormalization.
|
|
21
|
+
- 69 tests, 100% line + branch coverage. CI on macOS 14 ARM64 (Python 3.11/3.12/3.13) plus Linux lint/typecheck.
|
|
22
|
+
- Tier 1 parity tests for every MLX layer vs PyTorch reference.
|
|
23
|
+
- Tier 2 parity: pre-baked reference fixtures (committed to repo); decoder cosine sim > 0.999 on 5 fixtures per variant, encoder cosine sim 1.00000000.
|
|
24
|
+
- Tier 3 property tests via hypothesis (shape invariants, dtype propagation, determinism, roundtrip).
|
|
25
|
+
- Tier 5 perf budget: decode 1024×1024 fp16 < 200 ms; peak memory < 1.5 GB.
|
|
26
|
+
|
|
27
|
+
### Known limitations
|
|
28
|
+
- `LivePreviewCallback` without `bn_mean`/`bn_var` produces structurally-correct but color-shifted previews. Pass the BN stats from `Flux2VAE.bn.running_{mean,var}` for exact recovery.
|
|
29
|
+
- bf16 dtype works but isn't hardware-accelerated on M1/M2 (only M3+).
|
|
30
|
+
|
|
31
|
+
## [0.0.2] — 2026-05-12
|
|
32
|
+
|
|
33
|
+
Phase 2: all four variants + encoder side + property tests.
|
|
34
|
+
|
|
35
|
+
## [0.0.1-alpha] — 2026-05-12
|
|
36
|
+
|
|
37
|
+
Phase 1: TAEF2 decoder MVP.
|
mlx_taef-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlx-taef
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiny AutoEncoders for diffusion (TAESD family) on Apple MLX.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ionden/mlx-taef
|
|
6
|
+
Project-URL: Documentation, https://ionden.github.io/mlx-taef
|
|
7
|
+
Project-URL: Issues, https://github.com/ionden/mlx-taef/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/ionden/mlx-taef/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Denis Ineshin <denis.ineshin@gmail.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
Keywords: apple-silicon,autoencoder,flux,mlx,stable-diffusion,taesd
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: huggingface-hub>=0.24
|
|
25
|
+
Requires-Dist: mlx>=0.20
|
|
26
|
+
Requires-Dist: numpy>=1.26
|
|
27
|
+
Requires-Dist: safetensors>=0.4
|
|
28
|
+
Provides-Extra: image
|
|
29
|
+
Requires-Dist: pillow>=10.0; extra == 'image'
|
|
30
|
+
Provides-Extra: mflux
|
|
31
|
+
Requires-Dist: mflux>=0.17; extra == 'mflux'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# mlx-taef
|
|
35
|
+
|
|
36
|
+
Tiny AutoEncoders for diffusion latents on Apple Silicon, in pure MLX.
|
|
37
|
+
|
|
38
|
+
`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.
|
|
39
|
+
|
|
40
|
+
Use it for:
|
|
41
|
+
- **Live previews** during long generations on Mac — see each step refresh in <100 ms instead of waiting 30 s for the full VAE.
|
|
42
|
+
- **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).
|
|
43
|
+
- **Quick latent inspection** in notebooks and ML research.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import mlx.core as mx
|
|
47
|
+
from mlx_taef import TAEF2
|
|
48
|
+
|
|
49
|
+
taef = TAEF2.from_pretrained() # downloads + converts on first call
|
|
50
|
+
img = taef.decode(latents) # NHWC float in [0, 1]
|
|
51
|
+
img_uint8 = taef.decode_image(latents) # uint8 NHWC ready for PIL
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install mlx-taef
|
|
58
|
+
# With mflux preview callback:
|
|
59
|
+
pip install "mlx-taef[mflux]"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Requires Python ≥ 3.11 and Apple Silicon. Runtime install has **zero PyTorch dependency**.
|
|
63
|
+
|
|
64
|
+
## Variants
|
|
65
|
+
|
|
66
|
+
| Variant | latent_channels | For | HF source |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `TAESD` | 4 | Stable Diffusion 1.x | [madebyollin/taesd](https://huggingface.co/madebyollin/taesd) |
|
|
69
|
+
| `TAESDXL` | 4 | Stable Diffusion XL | [madebyollin/taesdxl](https://huggingface.co/madebyollin/taesdxl) |
|
|
70
|
+
| `TAEF1` | 16 | FLUX.1 | [madebyollin/taef1](https://huggingface.co/madebyollin/taef1) |
|
|
71
|
+
| `TAEF2` | 32 | FLUX.2 Klein | [madebyollin/taef2](https://huggingface.co/madebyollin/taef2) |
|
|
72
|
+
|
|
73
|
+
All four share one API.
|
|
74
|
+
|
|
75
|
+
## Benchmarks (M1 Max, fp16)
|
|
76
|
+
|
|
77
|
+
| Metric | TAEF2 (this library) | Full Flux VAE (reference) | Win |
|
|
78
|
+
|---|---|---|---|
|
|
79
|
+
| Decode latency 1024×1024 | **~100 ms** | seconds | 50–100× |
|
|
80
|
+
| Peak unified memory 1024×1024 | **~1 GB** | ~9.6 GB | **9.4×** |
|
|
81
|
+
| Output cosine sim vs PyTorch reference | > 0.999 | — | (parity verified) |
|
|
82
|
+
|
|
83
|
+
Numbers from `tests/test_perf.py` on M1 Max 32 GB. See `notes/phase1-benchmarks.md` for details.
|
|
84
|
+
|
|
85
|
+
## mflux live previews
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from mflux.models.flux2 import Flux2Klein
|
|
89
|
+
from mlx_taef.integrations.mflux import LivePreviewCallback
|
|
90
|
+
|
|
91
|
+
model = Flux2Klein.from_pretrained("4bit")
|
|
92
|
+
preview = LivePreviewCallback(
|
|
93
|
+
variant="taef2",
|
|
94
|
+
every=5,
|
|
95
|
+
save_to="preview.png",
|
|
96
|
+
latent_height=32, # 512 / 16
|
|
97
|
+
latent_width=32,
|
|
98
|
+
)
|
|
99
|
+
model.callbacks.register(preview)
|
|
100
|
+
model.generate_image(
|
|
101
|
+
prompt="a red apple on a wooden table",
|
|
102
|
+
num_inference_steps=25,
|
|
103
|
+
width=512,
|
|
104
|
+
height=512,
|
|
105
|
+
seed=42,
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
See `docs/manual-verification.md` for the full verification recipe.
|
|
112
|
+
|
|
113
|
+
## Status
|
|
114
|
+
|
|
115
|
+
- v0.1.0 — initial public release. All four variants, encoder + decoder, mflux integration, CI, 100% test coverage.
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT. Mirrors upstream [madebyollin/taesd](https://github.com/madebyollin/taesd) license. Pretrained weights belong to their respective authors (madebyollin).
|
|
120
|
+
|
|
121
|
+
## Acknowledgements
|
|
122
|
+
|
|
123
|
+
- [madebyollin](https://github.com/madebyollin) for the upstream TAESD-family models and weights.
|
|
124
|
+
- [Apple ML Explore](https://github.com/ml-explore/mlx) for MLX.
|
|
125
|
+
- [filipstrand/mflux](https://github.com/filipstrand/mflux) for the MLX-native FLUX runner this library integrates with.
|
mlx_taef-0.1.0/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# mlx-taef
|
|
2
|
+
|
|
3
|
+
Tiny AutoEncoders for diffusion latents on Apple Silicon, in pure MLX.
|
|
4
|
+
|
|
5
|
+
`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.
|
|
6
|
+
|
|
7
|
+
Use it for:
|
|
8
|
+
- **Live previews** during long generations on Mac — see each step refresh in <100 ms instead of waiting 30 s for the full VAE.
|
|
9
|
+
- **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).
|
|
10
|
+
- **Quick latent inspection** in notebooks and ML research.
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
import mlx.core as mx
|
|
14
|
+
from mlx_taef import TAEF2
|
|
15
|
+
|
|
16
|
+
taef = TAEF2.from_pretrained() # downloads + converts on first call
|
|
17
|
+
img = taef.decode(latents) # NHWC float in [0, 1]
|
|
18
|
+
img_uint8 = taef.decode_image(latents) # uint8 NHWC ready for PIL
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install mlx-taef
|
|
25
|
+
# With mflux preview callback:
|
|
26
|
+
pip install "mlx-taef[mflux]"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires Python ≥ 3.11 and Apple Silicon. Runtime install has **zero PyTorch dependency**.
|
|
30
|
+
|
|
31
|
+
## Variants
|
|
32
|
+
|
|
33
|
+
| Variant | latent_channels | For | HF source |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| `TAESD` | 4 | Stable Diffusion 1.x | [madebyollin/taesd](https://huggingface.co/madebyollin/taesd) |
|
|
36
|
+
| `TAESDXL` | 4 | Stable Diffusion XL | [madebyollin/taesdxl](https://huggingface.co/madebyollin/taesdxl) |
|
|
37
|
+
| `TAEF1` | 16 | FLUX.1 | [madebyollin/taef1](https://huggingface.co/madebyollin/taef1) |
|
|
38
|
+
| `TAEF2` | 32 | FLUX.2 Klein | [madebyollin/taef2](https://huggingface.co/madebyollin/taef2) |
|
|
39
|
+
|
|
40
|
+
All four share one API.
|
|
41
|
+
|
|
42
|
+
## Benchmarks (M1 Max, fp16)
|
|
43
|
+
|
|
44
|
+
| Metric | TAEF2 (this library) | Full Flux VAE (reference) | Win |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| Decode latency 1024×1024 | **~100 ms** | seconds | 50–100× |
|
|
47
|
+
| Peak unified memory 1024×1024 | **~1 GB** | ~9.6 GB | **9.4×** |
|
|
48
|
+
| Output cosine sim vs PyTorch reference | > 0.999 | — | (parity verified) |
|
|
49
|
+
|
|
50
|
+
Numbers from `tests/test_perf.py` on M1 Max 32 GB. See `notes/phase1-benchmarks.md` for details.
|
|
51
|
+
|
|
52
|
+
## mflux live previews
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from mflux.models.flux2 import Flux2Klein
|
|
56
|
+
from mlx_taef.integrations.mflux import LivePreviewCallback
|
|
57
|
+
|
|
58
|
+
model = Flux2Klein.from_pretrained("4bit")
|
|
59
|
+
preview = LivePreviewCallback(
|
|
60
|
+
variant="taef2",
|
|
61
|
+
every=5,
|
|
62
|
+
save_to="preview.png",
|
|
63
|
+
latent_height=32, # 512 / 16
|
|
64
|
+
latent_width=32,
|
|
65
|
+
)
|
|
66
|
+
model.callbacks.register(preview)
|
|
67
|
+
model.generate_image(
|
|
68
|
+
prompt="a red apple on a wooden table",
|
|
69
|
+
num_inference_steps=25,
|
|
70
|
+
width=512,
|
|
71
|
+
height=512,
|
|
72
|
+
seed=42,
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
See `docs/manual-verification.md` for the full verification recipe.
|
|
79
|
+
|
|
80
|
+
## Status
|
|
81
|
+
|
|
82
|
+
- v0.1.0 — initial public release. All four variants, encoder + decoder, mflux integration, CI, 100% test coverage.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT. Mirrors upstream [madebyollin/taesd](https://github.com/madebyollin/taesd) license. Pretrained weights belong to their respective authors (madebyollin).
|
|
87
|
+
|
|
88
|
+
## Acknowledgements
|
|
89
|
+
|
|
90
|
+
- [madebyollin](https://github.com/madebyollin) for the upstream TAESD-family models and weights.
|
|
91
|
+
- [Apple ML Explore](https://github.com/ml-explore/mlx) for MLX.
|
|
92
|
+
- [filipstrand/mflux](https://github.com/filipstrand/mflux) for the MLX-native FLUX runner this library integrates with.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Manual verification: mflux LivePreviewCallback
|
|
2
|
+
|
|
3
|
+
These steps require:
|
|
4
|
+
- mflux installed (`pip install mflux`)
|
|
5
|
+
- FLUX.2 Klein 4-bit weights downloaded (~5 GB)
|
|
6
|
+
- M-series Mac with 16 GB+ unified memory
|
|
7
|
+
|
|
8
|
+
This validates that `LivePreviewCallback` produces recognizable previews during a real generation. Automated tests use a fake-shaped latent and can't catch value-space drift.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Install mflux (in the mlx-taef venv):
|
|
13
|
+
```bash
|
|
14
|
+
uv pip install mflux
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. Run a generation with the callback:
|
|
18
|
+
```python
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from mflux.models.flux2 import Flux2Klein
|
|
21
|
+
from mlx_taef.integrations.mflux import LivePreviewCallback
|
|
22
|
+
|
|
23
|
+
model = Flux2Klein.from_pretrained("4bit")
|
|
24
|
+
callback = LivePreviewCallback(
|
|
25
|
+
variant="taef2",
|
|
26
|
+
every=5,
|
|
27
|
+
save_to=Path("preview.png"),
|
|
28
|
+
latent_height=32, # 512 / 16
|
|
29
|
+
latent_width=32,
|
|
30
|
+
)
|
|
31
|
+
model.callbacks.register(callback)
|
|
32
|
+
model.generate_image(
|
|
33
|
+
prompt="a red apple on a wooden table",
|
|
34
|
+
num_inference_steps=25,
|
|
35
|
+
width=512,
|
|
36
|
+
height=512,
|
|
37
|
+
seed=42,
|
|
38
|
+
)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. Verify `preview.png` updates every 5 steps with progressively clearer images. The final preview should be recognizable as "red apple on a wooden table."
|
|
42
|
+
|
|
43
|
+
## Known limitation
|
|
44
|
+
|
|
45
|
+
Without passing `bn_mean` and `bn_var` from `Flux2VAE.bn.running_{mean,var}`, the preview uses identity BN — structure is correct but colors may shift. For exact previews:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
flux2_vae = model.vae
|
|
49
|
+
callback = LivePreviewCallback(
|
|
50
|
+
...,
|
|
51
|
+
bn_mean=flux2_vae.bn.running_mean,
|
|
52
|
+
bn_var=flux2_vae.bn.running_var,
|
|
53
|
+
)
|
|
54
|
+
```
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27", "hatch-vcs>=0.4"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mlx-taef"
|
|
7
|
+
description = "Tiny AutoEncoders for diffusion (TAESD family) on Apple MLX."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [{ name = "Denis Ineshin", email = "denis.ineshin@gmail.com" }]
|
|
12
|
+
keywords = ["mlx", "stable-diffusion", "flux", "autoencoder", "taesd", "apple-silicon"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: MacOS :: MacOS X",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dynamic = ["version"]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"mlx>=0.20",
|
|
29
|
+
"numpy>=1.26",
|
|
30
|
+
"huggingface-hub>=0.24",
|
|
31
|
+
"safetensors>=0.4",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
mflux = ["mflux>=0.17"]
|
|
36
|
+
image = ["pillow>=10.0"]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/ionden/mlx-taef"
|
|
40
|
+
Documentation = "https://ionden.github.io/mlx-taef"
|
|
41
|
+
Issues = "https://github.com/ionden/mlx-taef/issues"
|
|
42
|
+
Changelog = "https://github.com/ionden/mlx-taef/blob/main/CHANGELOG.md"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
mlx-taef = "mlx_taef.cli:main"
|
|
46
|
+
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
test = [
|
|
49
|
+
"pytest>=8.3",
|
|
50
|
+
"pytest-cov>=5.0",
|
|
51
|
+
"hypothesis>=6.130",
|
|
52
|
+
"pytest-benchmark>=4.0",
|
|
53
|
+
]
|
|
54
|
+
typecheck = [
|
|
55
|
+
"mypy>=1.13",
|
|
56
|
+
]
|
|
57
|
+
lint = [
|
|
58
|
+
"ruff>=0.7",
|
|
59
|
+
]
|
|
60
|
+
docs = [
|
|
61
|
+
"mkdocs-material>=9.5",
|
|
62
|
+
"mkdocstrings[python]>=0.27",
|
|
63
|
+
]
|
|
64
|
+
# Reference-fixture generation only. Not for runtime.
|
|
65
|
+
fixtures = [
|
|
66
|
+
"torch>=2.4",
|
|
67
|
+
"pillow>=10.0",
|
|
68
|
+
]
|
|
69
|
+
dev = [
|
|
70
|
+
{ include-group = "test" },
|
|
71
|
+
{ include-group = "typecheck" },
|
|
72
|
+
{ include-group = "lint" },
|
|
73
|
+
{ include-group = "docs" },
|
|
74
|
+
{ include-group = "fixtures" },
|
|
75
|
+
"pre-commit>=3.8",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[tool.hatch.version]
|
|
79
|
+
source = "vcs"
|
|
80
|
+
|
|
81
|
+
[tool.hatch.build.hooks.vcs]
|
|
82
|
+
version-file = "src/mlx_taef/_version.py"
|
|
83
|
+
|
|
84
|
+
[tool.hatch.build.targets.wheel]
|
|
85
|
+
packages = ["src/mlx_taef"]
|
|
86
|
+
|
|
87
|
+
[tool.hatch.build.targets.sdist]
|
|
88
|
+
exclude = [
|
|
89
|
+
".github/",
|
|
90
|
+
".hypothesis/",
|
|
91
|
+
".pre-commit-config.yaml",
|
|
92
|
+
"notes/",
|
|
93
|
+
"tests/_third_party/",
|
|
94
|
+
"tests/converted/",
|
|
95
|
+
"tests/reference/",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[tool.ruff]
|
|
99
|
+
src = ["src"]
|
|
100
|
+
line-length = 100
|
|
101
|
+
target-version = "py311"
|
|
102
|
+
|
|
103
|
+
[tool.ruff.lint]
|
|
104
|
+
select = [
|
|
105
|
+
"E", "W", "F",
|
|
106
|
+
"I",
|
|
107
|
+
"B",
|
|
108
|
+
"UP",
|
|
109
|
+
"RUF",
|
|
110
|
+
"SIM",
|
|
111
|
+
"C4",
|
|
112
|
+
"PIE", "PT", "RET",
|
|
113
|
+
"PTH",
|
|
114
|
+
"TID",
|
|
115
|
+
"TCH",
|
|
116
|
+
"N",
|
|
117
|
+
"D",
|
|
118
|
+
"ANN",
|
|
119
|
+
"PYI",
|
|
120
|
+
"PERF",
|
|
121
|
+
"FURB",
|
|
122
|
+
"NPY",
|
|
123
|
+
]
|
|
124
|
+
ignore = [
|
|
125
|
+
"ANN401",
|
|
126
|
+
"E501",
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
[tool.ruff.lint.pydocstyle]
|
|
130
|
+
convention = "google"
|
|
131
|
+
|
|
132
|
+
[tool.ruff.lint.per-file-ignores]
|
|
133
|
+
"tests/**/*.py" = ["D", "ANN", "S101"]
|
|
134
|
+
"tests/_third_party/**/*.py" = ["ALL"]
|
|
135
|
+
"examples/**/*.py" = ["D", "ANN"]
|
|
136
|
+
"notes/**/*.py" = ["D", "ANN", "RUF", "RET"]
|
|
137
|
+
|
|
138
|
+
[tool.ruff.format]
|
|
139
|
+
docstring-code-format = true
|
|
140
|
+
exclude = ["tests/_third_party/**/*.py"] # vendored; preserve original formatting
|
|
141
|
+
|
|
142
|
+
[tool.mypy]
|
|
143
|
+
python_version = "3.11"
|
|
144
|
+
strict = true
|
|
145
|
+
warn_unreachable = true
|
|
146
|
+
enable_error_code = ["redundant-expr", "truthy-bool", "ignore-without-code"]
|
|
147
|
+
files = ["src/mlx_taef"]
|
|
148
|
+
|
|
149
|
+
[tool.pytest.ini_options]
|
|
150
|
+
minversion = "8.0"
|
|
151
|
+
addopts = "-ra --strict-markers --strict-config"
|
|
152
|
+
testpaths = ["tests"]
|
|
153
|
+
xfail_strict = true
|
|
154
|
+
markers = [
|
|
155
|
+
"slow: tests >1s",
|
|
156
|
+
"gpu: requires Metal GPU",
|
|
157
|
+
"network: requires network access (skipped in CI)",
|
|
158
|
+
"benchmark: perf test (skipped in CI)",
|
|
159
|
+
"integration: needs real model checkpoint",
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
[tool.coverage.run]
|
|
163
|
+
branch = true
|
|
164
|
+
source = ["mlx_taef"]
|
|
165
|
+
parallel = true
|
|
166
|
+
omit = ["src/mlx_taef/_version.py"] # generated by hatch-vcs; no user code
|
|
167
|
+
|
|
168
|
+
[tool.coverage.report]
|
|
169
|
+
exclude_lines = [
|
|
170
|
+
"pragma: no cover",
|
|
171
|
+
"if TYPE_CHECKING:",
|
|
172
|
+
"@overload",
|
|
173
|
+
"raise NotImplementedError",
|
|
174
|
+
]
|
|
175
|
+
show_missing = true
|
|
176
|
+
fail_under = 85
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""mlx-taef: Tiny AutoEncoder family ported to Apple MLX."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from mlx_taef.api import TAEF1, TAEF2, TAESD, TAESDXL, Taef
|
|
6
|
+
|
|
7
|
+
__all__ = ["TAEF1", "TAEF2", "TAESD", "TAESDXL", "Taef"]
|
|
8
|
+
|
|
9
|
+
logging.getLogger("mlx_taef").addHandler(logging.NullHandler())
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.1.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|