Repository navigation
Conversation
Add `src/imagegen/` with the model-independent pieces shared by every text-to-image and image-editing family: request and result types, the checkpoint family probe, the flow-match Euler scheduler (dynamic and static shift), latent patching and packing, the FLUX.2 VAE, the Z-Image DiT blocks, the Qwen3 hidden-state conditioner, PNG output, and the family registry (empty until a model issue registers a row). Surfaces: - `mlxcel generate-image` (generate and edit, -n, --seed, --gen-kwargs) - `mlxcel-server --image-model` with `POST /v1/images/generations` and `POST /v1/images/edits`, served by a dedicated worker; without the flag both routes answer 501 naming it - `Runtime::ImageGenerate` and `OutputKind::Image` in the registry - `generate`/`serve` on an image checkpoint now point at `mlxcel generate-image` instead of failing with `model_type not found` `Qwen3Model` gains `forward_all_hidden`, one added method that reuses the existing blocks. Teacher-forced logit traces on Qwen3-0.6B-4bit before and after are byte-identical. Tests compare against the upstream Python (Blaizzy/mlx-vlm) through committed fixtures; `tests/fixtures/generate_imagegen_fixtures.py` regenerates them exactly. The real ERNIE-Image-Turbo VAE matches upstream f32 to a relative RMS of 3e-6 (decode), 1.2e-6 (packed decode) and 3e-6 (encode). Upstream's `_match_conv_layout` leaves the encoder's RGB `conv_in` in PyTorch layout, which breaks its encoder; this port decides the layout once per checkpoint. Refs lablup#2341
Add docs/image-generation.md (CLI, server routes, probe, shared building blocks, precision decision, family registration, verification) and point to it from the README and the environment variable reference. Refs lablup#2341
Discard expired queued requests before GPU execution, cap output pixel counts and explicit diffusion steps, and replace the predictable output probe with atomic exclusive creation. Add regression coverage for deadline handling, request limits, existing files and symlinks. Declare the four reproducible numerical fixtures with individual size ceilings and an explicit aggregate binary budget. Document the limits and the remaining inability to interrupt an already-running generation. Refs lablup#2341 Refs lablup#2497
Document the test-only checkpoint directory, default lookup path, skip behavior and ignored-test invocation. Validate the current main merge tree with the environment-variable documentation guard and all 15 guard tests. Refs lablup#2341 Refs lablup#2497
gelu_approx is the exact erf form, not the tanh-approximate GELU, and gelu_sigmoid's doc pointed at a helper whose name does not exist in this tree. Drop the stale reference and restate both docs.
…p#2778) A temperature 0 run through a block verification path (--prompt-lookup or a draft model) can leave the plain-decode stream near a logit tie: the verify block builds post-first-row K/V at M = block width, a different quantized kernel path than the one-token decode step, so the logits differ at rounding scale and the argmax can flip where the reference's top two logits are tied or nearly tied. This is the temperature 0 contract, not a defect; no code change is made. - docs/temperature-0-block-history-flip.md: the investigation, teacher-forced and end-to-end measurements, repro commands, and the limits of the evidence (the issue's original 35-logit swing at position 197 is not reproduced). - scripts/matched_width_trace.sh, scripts/compare_matched_width.py: the matched-context (PREFILL = 128 + j) trace harness and comparator that redo every Evidence 1 figure. - CHANGELOG: a Known limitations entry under Unreleased pointing at the document (lablup#2778, does not block 0.8.0). Every number in the document is traceable to a command recorded there.
This was referenced Nov 6, 2026
Contributor
Author
|
Superseded by #2879. This branch was cut from a stale fork base and carried 5 unrelated commits (imagegen and others already merged upstream), which inflated the PR-visible diff to 70 files / +10430. Rather than rewrite published history, the single intended commit was replayed onto current Closing this one. Nothing here is lost: the contents live in #2879. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2778 (documentation deliverable; the issue's reproducer criterion stays open).
What this adds
docs/temperature-0-block-history-flip.md— the Explain the temperature 0 flip between plain and block-built KV history #2778 investigation recorded as a maintainer-reverifiable documentation artifact, following thedocs/benchmarks.md"Judging a change that moves the numbers" method (byte-identity says only yes or no, so the comparisons are teacher-forced and gated on how decided the reference was).scripts/matched_width_trace.sh+scripts/compare_matched_width.py— the matched-context trace harness (WIDTH=8,PREFILL=128,BLOCKS=48; width-1 references traced atPREFILL = 128 + j) and comparator that redo every Evidence 1 number.CHANGELOG.md— a### Known limitationsentry under Unreleased.Cause named, and why no code fix
Argmax decidedness flip. A block verification path builds the K/V of every row after the first with a different arithmetic path than a one-token decode step (the quantized projections run at
M = block width, and MLX picks a kernel perM), so the logits differ at rounding scale; the argmax flips only where the reference's top two logits are tied or nearly tied, and the rest of the stream follows from that one token. This is the temperature 0 contract — every emitted token is the argmax of the logits the path computed — not a defect, so no code change is made. The conclusion is kept tentative: it covers the flips reproduced in the document, and it does not explain the issue's original 35-logit swing at position 197 (prompt text and KV mode of the original runs are not in the issue; those runs were on M1 Ultra, these on M1 Pro).How issue #2778's acceptance criteria stand
Mis not a property any quantized kernel set provides; chasing it gives up verify throughput for a guaranteedocs/benchmarks.mdalready says is spent once the arithmetic path differs.Repro anchors
cargo build --release --features metal,accelerate --example logit_trace, thenlogit_trace MODEL corpus_long.txt 8 48 8 128plus the matched width-1 arms;scripts/matched_width_trace.sh+scripts/compare_matched_width.pyin the repo.mlxcel generate -m MODEL -p PROMPT -n 160 --temp 0 --seed 42 --kv-cache-mode {fp16,int8,fp16+turbo3,fp16+turbo4} --show-reasoning [--prompt-lookup](documented in the document's Evidence 3 section with its normalization script).Evidence for each number is a command recorded in the document.