mflux-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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file type. We recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Denis Ineshin
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,53 @@
1
+ mflux-taef
2
+ Copyright 2026 the mflux-plugins contributors
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ ------------------------------------------------------------------------------
11
+ Third-party attributions
12
+ ------------------------------------------------------------------------------
13
+
14
+ This product includes software derived from mflux
15
+ (https://github.com/mflux-community/mflux), licensed under MIT License:
16
+
17
+ MIT License
18
+
19
+ Copyright (c) 2026 Filip Strand
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+
39
+ src/mflux/extras/taef/z_image.py (warn_ineffective_options) copies a
40
+ block of statements from main() in mflux's
41
+ src/mflux/models/z_image/cli/z_image_generate.py.
42
+
43
+ src/mflux/extras/taef/z_image_turbo.py (warn_before_load) copies
44
+ statements from main() in mflux's
45
+ src/mflux/models/z_image/cli/z_image_turbo_generate.py.
46
+
47
+ src/mflux/extras/taef/_core.py (_is_hf_format) copies the
48
+ PathResolution._is_hf_format check from mflux's
49
+ src/mflux/models/common/resolution/path_resolution.py.
50
+
51
+ src/mflux/extras/taef/_core.py (_option_was_provided) copies the
52
+ CommandLineParser._option_was_provided argv scan from mflux's
53
+ src/mflux/cli/parser/parsers.py.
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: mflux-taef
3
+ Version: 0.1.0
4
+ Summary: Live TAEF previews for mflux's command line, powered by mlx-taef.
5
+ Keywords: mflux,mlx,taef,preview,apple-silicon,diffusion,z-image
6
+ Author: Denis Ineshin
7
+ Author-email: Denis Ineshin <denis.ineshin@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Dist: mlx-taef[mflux]>=0.9.0
18
+ Requires-Dist: mflux>=0.24
19
+ Maintainer: Denis Ineshin
20
+ Maintainer-email: Denis Ineshin <denis.ineshin@gmail.com>
21
+ Requires-Python: >=3.11
22
+ Project-URL: Homepage, https://github.com/mflux-community/mflux-plugins/tree/main/taef
23
+ Project-URL: Repository, https://github.com/mflux-community/mflux-plugins
24
+ Project-URL: Issues, https://github.com/mflux-community/mflux-plugins/issues
25
+ Project-URL: Documentation, https://github.com/mflux-community/mflux-plugins/tree/main/taef#readme
26
+ Description-Content-Type: text/markdown
27
+
28
+ # mflux-taef
29
+
30
+ Adds two commands to [mflux](https://github.com/mflux-community/mflux): `mflux-generate-z-image-turbo-taef` and
31
+ `mflux-generate-z-image-taef`. Each takes every option of the mflux command it mirrors
32
+ (`mflux-generate-z-image-turbo` and `mflux-generate-z-image`), runs mflux's own loading and generation steps, and
33
+ writes a live preview image while the picture is being denoised. Open the file in Preview or Quick Look, and press
34
+ Ctrl-C when the composition is wrong instead of waiting for the last step.
35
+
36
+ The preview is the image as it stands after the current step, decoded by a tiny decoder from
37
+ [mlx-taef](https://github.com/IonDen/mlx-taef). It is not the final image, which mflux still decodes with the model's
38
+ own VAE and saves the usual way.
39
+
40
+ mflux-taef lives in the `taef/` folder of [mflux-plugins](https://github.com/mflux-community/mflux-plugins), the plugin
41
+ repository of the mflux-community organization. Denis Ineshin maintains it. The tiny decoder is in mlx-taef, a separate
42
+ Python library by the same author; this package connects it to mflux's command line.
43
+ [Versions](#versions) lists what it installs with.
44
+
45
+ ## Install
46
+
47
+ The recommended setup puts mflux and this package in one tool environment:
48
+
49
+ ```bash
50
+ uv tool install mflux --with-executables-from mflux-taef
51
+ ```
52
+
53
+ You get mflux's commands and the two TAEF commands side by side. In a virtual environment that already has mflux:
54
+
55
+ ```bash
56
+ pip install mflux-taef
57
+ ```
58
+
59
+ Installing the package brings in mlx-taef. The first run downloads the decoder and converts it for MLX;
60
+ later runs reuse it.
61
+
62
+ ## Usage
63
+
64
+ Use the Turbo command for Turbo; the base command runs both.
65
+
66
+ ```bash
67
+ mflux-generate-z-image-turbo-taef --prompt "a lighthouse on a cliff at dusk" --steps 8 --seed 42
68
+ ```
69
+
70
+ Every `mflux-generate-z-image-turbo` option works the same way. For Z-Image base:
71
+
72
+ ```bash
73
+ mflux-generate-z-image-taef --prompt "a lighthouse on a cliff at dusk" --steps 50 --guidance 4.0 --seed 42
74
+ ```
75
+
76
+ Before each image the command prints where its preview goes, for example
77
+ `TAEF preview: image.preview.png, every step (zimage decoder)`.
78
+
79
+ Three options control the preview:
80
+
81
+ | Option | Default | What it does |
82
+ |---|---|---|
83
+ | `--taef-preview PATH` | `<output name>.preview.png`, next to the output image | Where the preview goes: a `.png`, `.jpg`, `.jpeg` or `.webp` file (any letter case). `PATH` may contain `{seed}`. |
84
+ | `--taef-every N` | every step | Update the preview every `N` steps; `N` is 1 or more. |
85
+ | `--taef-frames` | off | Keep every step as its own file, `<preview name>_stepNN.<suffix>`. |
86
+
87
+ `--taef-frames` writes every step, so it can't be combined with `--taef-every`. `NN` counts the steps this run
88
+ executed, so an image-to-image run, which starts partway through the schedule, numbers from its own first step.
89
+
90
+ ### Where the files go
91
+
92
+ By default the preview sits next to the final image: for `--output out.png` it is `out.preview.png`. With several
93
+ seeds, mflux adds `_seed_<n>` to the output name, so the previews get it too.
94
+
95
+ An explicit `--taef-preview PATH` is one live file, and each seed overwrites it in turn, so reopen the file to see the
96
+ latest preview. Put `{seed}` in `PATH` to get one file per seed instead. With `--taef-frames` and several seeds,
97
+ `_seed_<n>` is added to the end of the name, so each seed keeps its own `..._seed_<n>_stepNN...` files. The line the
98
+ command prints before each seed shows the real path for that seed.
99
+
100
+ ### Previews and `--stepwise-image-output-dir`
101
+
102
+ mflux's `--stepwise-image-output-dir` decodes every step with the model's full VAE and keeps every step plus a
103
+ composite image. A preview goes through the tiny decoder into one file. mlx-taef's
104
+ [comparison page](https://github.com/IonDen/mlx-taef/blob/main/COMPARISON.md) has the published decode speed and the
105
+ similarity to the full VAE for Z-Image; this package adds no timing figure of its own.
106
+
107
+ The two options can run in the same command: mflux writes its step images to its directory and this package writes the
108
+ preview file or frames to the preview path.
109
+
110
+ ## Checked on real weights
111
+
112
+ On 2026-11-09 the TAEF commands below ran on real weights, and the single-seed 512×512 ones were compared with the
113
+ plain mflux command with the same options. The machine was an Apple M1 Max with 32 GB, macOS 27.2, Python 3.13,
114
+ mflux 0.24.0 and mlx-taef 0.9.0. The prompt was "a red apple on a wooden table" and the seed 42. The models were
115
+ `mflux-community/z-image-turbo-mflux-q4` and `mflux-community/z-image-base-mflux-q4`. The first two lines are the plain
116
+ commands the TAEF images were compared with; the rest are the TAEF commands:
117
+
118
+ ```bash
119
+ mflux-generate-z-image-turbo --model mflux-community/z-image-turbo-mflux-q4 --prompt "a red apple on a wooden table" --steps 8 --seed 42 --width 512 --height 512 --output image.png
120
+ mflux-generate-z-image --model mflux-community/z-image-base-mflux-q4 --base-model z-image --prompt "a red apple on a wooden table" --steps 20 --guidance 4.0 --low-ram --seed 42 --width 512 --height 512 --output image.png
121
+ mflux-generate-z-image-turbo-taef --model mflux-community/z-image-turbo-mflux-q4 --prompt "a red apple on a wooden table" --steps 8 --seed 42 --width 512 --height 512 --output image.png
122
+ mflux-generate-z-image-turbo-taef --model mflux-community/z-image-turbo-mflux-q4 --prompt "a red apple on a wooden table" --steps 8 --seed 42 --width 512 --height 512 --output image.png --taef-frames
123
+ mflux-generate-z-image-turbo-taef --model mflux-community/z-image-turbo-mflux-q4 --prompt "a red apple on a wooden table" --steps 8 --seed 42 43 --width 512 --height 512 --output image.png
124
+ mflux-generate-z-image-taef --model mflux-community/z-image-base-mflux-q4 --base-model z-image --prompt "a red apple on a wooden table" --steps 20 --guidance 4.0 --low-ram --seed 42 --width 512 --height 512 --output image.png --taef-every 5
125
+ mflux-generate-z-image-taef --model mflux-community/z-image-base-mflux-q4 --base-model z-image --prompt "a red apple on a wooden table" --steps 8 --guidance 4.0 --seed 42 --width 1024 --height 1024 --output image.png
126
+ ```
127
+
128
+ - Turbo, 512×512: the TAEF image was pixel-identical to the plain one, and a 512×512 preview was written. With
129
+ `--taef-frames` the image was identical again, and 8 per-step preview files were written instead of the single
130
+ preview.
131
+ - Turbo with `--seed 42 43`: the seed-42 image was identical to the single-seed plain image, and each seed got its own
132
+ preview.
133
+ - Base, 512×512, with `--low-ram` and `--taef-every 5`: the image was identical to the plain one, and a preview was
134
+ written.
135
+ - Base, 1024×1024: the TAEF command finished and wrote the image and a 1024×1024 preview. There was no plain run of
136
+ that recipe, so there is no comparison.
137
+ - Ctrl-C after step 3 of 8 (the Turbo 512×512 TAEF command): mflux printed "Stopping image generation at step", the
138
+ exit code was 0, no image was written, and the preview stayed on disk.
139
+
140
+ In the single-image 512×512 Turbo runs above, the TAEF command used more memory than the plain one; that is one
141
+ comparison on one machine. The TAEF Turbo command was also started at 1024×1024 and did not finish in this test, so nothing here covers
142
+ Turbo at that size.
143
+
144
+ ## What the command checks
145
+
146
+ The command checks your request before it loads any weights. When it can't run, it stops with exit code 2 and a message
147
+ that says why. These refusals also tell you to run the plain mflux command to generate without previews:
148
+
149
+ - `--taef-every` below 1;
150
+ - a preview file that doesn't end in `.png`, `.jpg`, `.jpeg` or `.webp`;
151
+ - a `--taef-preview` with a `{...}` field other than `{seed}`, or a `{seed}` field with more than a width. `{seed}`
152
+ takes a width of one to three digits (padded with spaces, or with zeros when it starts with 0), optionally followed
153
+ by `d`, so `{seed:04d}` and `{seed:3}` run. A conversion such as `{seed!r}`, a bare `{seed:d}`, any other spec and a
154
+ width of more than three digits (`{seed:0004}` included) are refused.
155
+
156
+ These refusals only explain the problem:
157
+
158
+ - `--taef-every` together with `--taef-frames`;
159
+ - a `--taef-preview` path that is an existing directory or a symbolic link. The check runs before anything loads. With
160
+ `--taef-frames` the same goes for an existing directory or symbolic link at any `<preview name>_stepNN.<suffix>`
161
+ frame name in the preview's folder;
162
+ - a preview file name over 255 bytes, which is the most a file name can have. A `{seed:999}` width can reach that. With
163
+ `--taef-frames` the longest frame name is measured. Without this check the model would load and the first save would
164
+ fail, which turns the preview off;
165
+ - a preview path that names the same file as `--output`, or, with several seeds, as any seed's output (for example
166
+ `--seed 2 12 --output a.png --taef-preview 'a_seed_1{seed}.png'`). The match ignores letter case, because a default
167
+ macOS volume does. With `--taef-frames` the preview path itself is never written, so `--output` is compared with the
168
+ `<preview name>_stepNN.<suffix>` frame names instead. Without this check the last preview would take the name, and
169
+ mflux would save the final image under another one;
170
+ - a `--model` that is not one of mflux's names, not a local path that exists and not a Hugging Face repo id
171
+ (`org/model`). On an mflux whose model-path rules differ from the checked release, the name is left to mflux. A
172
+ missing path restored with `-C` names the file it came from;
173
+ - anything mflux's own option checks refuse, with mflux's own message.
174
+
175
+ Exit codes:
176
+
177
+ - 0: the run finished, you pressed Ctrl-C during generation (the last preview stays on disk), or the prompt file
178
+ couldn't be read.
179
+ - 1: the decoder couldn't be prepared (checked before the model loads; it prints `could not prepare the TAEF preview
180
+ decoder`), or the run failed after the model loaded (the traceback is printed).
181
+ - 2: the request was refused before any weights loaded.
182
+
183
+ If a preview fails during a run (a decode error, a folder you can't write to), the command prints one warning on
184
+ stderr, stops previews for that seed and finishes the image. The plugin writes nothing into the image's metadata or the
185
+ `--make-conf` sidecar, so the final image's metadata is what the plain command writes.
186
+
187
+ ## What it doesn't do
188
+
189
+ - No fast final decode. The tiny decoder is for previews; the saved image still uses the model's VAE. mflux's own
190
+ `--low-ram` stays the option for decode memory. mflux decodes in row strips by default, and `--vae-full-precision`
191
+ switches that off.
192
+ - No composite image, GIF or video, no terminal or window display, and no record in the image's metadata.
193
+ - No prediction previews for Z-Image: mflux doesn't pass the model's prediction to Z-Image callbacks, so the preview
194
+ decodes the latent.
195
+ - No FLUX.1, FLUX.2, Qwen-Image or other model families yet (Qwen-Image 2.1 included).
196
+ - No command that combines TAEF with TeaCache (see the next section).
197
+
198
+ ## With mflux-teacache
199
+
200
+ The two plugins install into one environment, because each adds only its own part of the `mflux.extras` namespace:
201
+
202
+ ```bash
203
+ pip install mflux-taef mflux-teacache
204
+ ```
205
+
206
+ They don't combine on the command line: `mflux-generate-z-image-teacache` has no `--taef-preview`, and the TAEF
207
+ commands don't skip steps. The libraries do work together from Python. TeaCache supports Z-Image base, not Turbo:
208
+
209
+ ```python
210
+ from pathlib import Path
211
+
212
+ from mflux.models.common.config.model_config import ModelConfig
213
+ from mflux.models.z_image.variants.z_image import ZImage
214
+ from mlx_taef.integrations.mflux import LivePreviewCallback
215
+ from mlx_teacache import apply_teacache
216
+
217
+ model = ZImage(model_config=ModelConfig.z_image(), quantize=8)
218
+ handle = apply_teacache(model)
219
+ preview = LivePreviewCallback(flux=model, every=1, save_to=Path("preview.png"))
220
+ model.callbacks.register(preview)
221
+ image = model.generate_image(
222
+ seed=42, prompt="a lighthouse on a cliff at dusk", width=512, height=512, guidance=4.0, num_inference_steps=50
223
+ )
224
+ image.save("out.png")
225
+ ```
226
+
227
+ ## Versions
228
+
229
+ - Python 3.11 or newer, on Apple Silicon.
230
+ - mflux 0.24 or newer, with no upper limit.
231
+ - mlx-taef 0.9.0 or newer.
232
+
233
+ What changed in each release is in
234
+ [CHANGELOG.md](https://github.com/mflux-community/mflux-plugins/blob/main/taef/CHANGELOG.md).
235
+
236
+ ## Development
237
+
238
+ From the `taef/` folder of an mflux-plugins checkout:
239
+
240
+ ```bash
241
+ uv sync --locked
242
+ uv run pytest
243
+ uv run ruff check . && uv run ruff format --check .
244
+ uv run ty check src
245
+ ```
246
+
247
+ The tests use stand-ins for the model and a random decoder, and never download weights. `AGENTS.md` describes the
248
+ package layout and its rules.
249
+
250
+ ## License
251
+
252
+ Apache-2.0. `NOTICE` lists the code this package copies from mflux, which is MIT-licensed.