Repository navigation
Conversation
…ered to diffusion GGUFs
…and match official Z-Image defaults
…ible per-run seeds
…toolbar, and timestamped export filenames
…alformed gallery records
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 030a565b06
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a local text-to-image (diffusion) backend to the application, featuring model loading, image generation, disk-backed gallery persistence, and a single-GPU arbiter to coordinate VRAM usage between chat and image generation tasks. It also adds the corresponding frontend UI, routing, and comprehensive unit tests. The review feedback identifies a critical pagination bug in the image gallery where slicing is performed before filtering out invalid files, and points out a violation of model detection rules in the family detection logic due to raw substring matching instead of segment-boundary checks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0607351a81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a local text-to-image diffusion backend, featuring a single-GPU arbiter to manage VRAM allocation between chat and image generation, a disk-backed image gallery, and a new 'Images' frontend page with custom controls. Feedback on these changes highlights two key improvements: first, preventing an API exception when repo_id is a local path in _estimate_download_bytes to ensure companion files are properly prefetched; second, tracking the mount status of the ImagesPage component to prevent sequential generation requests from continuing in the background if a user navigates away.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0607351a81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Went through the new round of Codex and Gemini comments. One code change, the rest left alone with reasoning below. Changed
Left as-is, with reasoning
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bebf1ca0c2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bebf1ca0c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d78869e308
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } catch { | ||
| // Transient poll failure: keep trying. | ||
| } | ||
| pollTimer.current = setTimeout(() => void pollLoadProgress(), 1000); |
There was a problem hiding this comment.
Stop rescheduling load polls after unmount
When the Images page is left while getDiffusionLoadProgress() is still in flight, the cleanup has no timeout to clear; once that await returns, this line unconditionally schedules another poll. That leaves a hidden polling loop running after unmount and can later call state setters or show the “Model loaded”/error toast on another page, despite the cleanup intending to dismiss the load toast. Guard the callback with an unmounted/cancelled flag or abort the poll before rescheduling.
Useful? React with 👍 / 👎.
| for (let i = 0; i < runs; i++) { | ||
| const res = await generateDiffusionImage({ |
There was a problem hiding this comment.
Stop multi-run generation when the page unmounts
If the user starts a multi-run generation (count > 1) and navigates away after the first request is sent, the cleanup only clears the progress interval; this async loop keeps issuing the remaining /images/generate calls because nothing checks an unmounted/cancelled flag between iterations. A long “Runs” value can therefore continue consuming the GPU and saving gallery images from a page the user left, so the loop should stop on unmount or before starting the next run.
Useful? React with 👍 / 👎.
| return | ||
| self._state = None | ||
| del state | ||
| clear_gpu_cache() |
There was a problem hiding this comment.
Clear the MPS cache when unloading image models
On Apple Silicon this backend can load the diffusion pipeline on mps, but this unload path delegates to clear_gpu_cache(), which is keyed off the global hardware detector that reports MLX on those hosts and takes the MLX no-op branch. Unloading or replacing an Images model there deletes Python references without releasing PyTorch MPS cached memory, making subsequent image loads or training more likely to OOM; clear based on state.device or call torch.mps.empty_cache() for MPS pipelines.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0e4549494
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # holding. No-op when diffusion isn't loaded. | ||
| from core.inference.gpu_arbiter import acquire_for, CHAT | ||
|
|
||
| await asyncio.to_thread(acquire_for, CHAT) |
There was a problem hiding this comment.
Defer chat GPU acquisition until validation passes
When an Images model is loaded, this acquires the chat owner and evicts diffusion before the request has passed the ModelConfig.from_identifier validation and the chat/training VRAM guard below. A bad or unsupported chat selection, or a later 400/409, therefore unloads a working image pipeline even though no chat model ends up loaded; the image load path already validates before acquiring for the same reason. Move the acquisition until after the later rejection paths, while still acquiring before an actual chat load or already-loaded success needs ownership.
Useful? React with 👍 / 👎.
| # Local image generation (Images page): diffusers' GGUFQuantizationConfig needs | ||
| # the gguf reader. diffusers itself is torch-bound and comes via the ML stack; | ||
| # gguf is torch-free so it lives here, where it's installed in every mode. | ||
| gguf |
There was a problem hiding this comment.
Pin diffusers to a version with these pipelines
Adding only gguf leaves the ML stack free to keep any already-satisfying diffusers version, but load_pipeline() now dynamically requires APIs such as GGUFQuantizationConfig and Flux2KleinPipeline. In an environment that resolves or already has an older diffusers release, the Images tab installs cleanly but selecting the new curated FLUX.2/GGUF models fails at load time; add an appropriate minimum diffusers version alongside this dependency change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b4e1345ec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "qwen_image", | ||
| "qwenimage", |
There was a problem hiding this comment.
Classify Z-Image GGUFs as image models
When a supported Z-Image GGUF is discovered from the HF cache or a local/custom folder by general.architecture, _repo_gguf_task/_local_model_task route through this allow-list before the Images picker sees it. The backend supports Z-Image (including the zimage/z_image aliases in detect_family), but those architecture keys are absent here, so such on-device Z-Image files are tagged as text-generation, hidden from Images, and can be surfaced to the chat picker where they are not loadable; add the Z-Image architecture values to this set.
Useful? React with 👍 / 👎.
|
Moved to #6763 |
…bf16_supported torch.cuda.is_bf16_supported() defaults to counting pre-Ampere bf16 EMULATION as supported, so on a T4/V100/RTX 20xx the DiT-training bf16 gates all passed even though the trainer requires native Ampere-or-newer bf16: /diffusion/info advertised the DiT precision modes, /diffusion/start's preflight let the run through and freed resident GPU models, then the trainer child hit the real unsupported bf16 path. The inference device resolver already fixed this (issue #6658) by gating NVIDIA on capability major >= 8; the training path never got it. Add a shared native_bf16_supported() helper (NVIDIA cap major >= 8; ROCm keeps the trustworthy is_bf16_supported()) and use it in the three DiT bf16 sites -- train_precision_modes, bf16_unsupported_reason, and the trainer guard -- so a pre-Ampere card is offered nf4 only and never advertises/evicts-then-fails. Tests now exercise the emulation case (is_bf16_supported True but capability < 8).
This PR adds image generation support through diffusers, using Unsloth GGUFs.
Everything is contained in a new Image tab, which has
How it works
The model menu is the same picker used for chat. In the Image tab it lists only image-generation GGUFs, and in the chat tab it excludes them, so neither lists the other's models.
Only the transformer ships as a GGUF, so the matching VAE, text encoder(s) and scheduler are pulled from the model's base diffusers repo. That base repo is resolved automatically from the GGUF repo's
base_modeltag.The GPU is shared with the chat backend: loading an image model automatically evicts the loaded chat model and vice versa, so only one ever sits in VRAM.
Model architectures
The following models have been tested and integrated. Detection is by architecture, so one entry covers every quant and variant:
Tested but not integrated:
Features
Not covered
torch.compileoption (same as above)Prior work
The single-GPU handoff between chat and diffusion is adapted from #5754 by @danielhanchen. #5872 is a related WIP that also adds diffusion (including video).