Repository navigation
Studio: pick the sampler on the Images page and load v-prediction SDXL checkpoints correctly - #13569
Conversation
…L checkpoints correctly
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd0febb9c8
ℹ️ 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".
| "karras": ("Karras", "use_karras_sigmas"), | ||
| "exponential": ("Exponential", "use_exponential_sigmas"), | ||
| } | ||
| _SIGMA_FLAGS = ("use_karras_sigmas", "use_exponential_sigmas", "use_beta_sigmas") |
There was a problem hiding this comment.
Clear every inherited schedule-selection flag
When the resident DPMSolverMultistepScheduler config has use_lu_lambdas=True or use_flow_sigmas=True, choosing Uniform only clears the three flags in this tuple, so from_config preserves the omitted flag and the generated image continues using the inherited LU/flow schedule while the recipe records Uniform. An inherited LU schedule can also take precedence over a requested Exponential schedule in set_timesteps. Clear all mutually exclusive schedule-selection fields supported by the target scheduler before enabling the selected one.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 44c6273: use_lu_lambdas is cleared with the sigma flags, and a scheduler configured for flow sigmas or flow prediction offers no samplers.
| changeSamplerChoice({ | ||
| sampler: image.sampler ?? DEFAULT_SAMPLER, | ||
| scheduleType: image.schedule_type ?? AUTOMATIC_SCHEDULE, | ||
| }); |
There was a problem hiding this comment.
Preserve restored samplers while no model is loaded
When the user restores a gallery recipe while the model is unloaded, samplerOptions is empty and samplerModelKey is "", so this call normalizes every recorded sampler to the default and withSamplerChoice declines to store it. The subsequent Generate auto-recalls the remembered model but runs with its previous/default sampler even though the UI reported that the recipe settings were restored; retain the recipe choice until the recalled model's options are available.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 44c6273: Restore keeps the recipe's choice until the recalled model's options exist, so the auto-loaded Generate runs with it.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44c62738fe
ℹ️ 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".
| const samplerModelKey = status?.loaded ? `${status.repo_id ?? ""}|${status.gguf_filename ?? ""}` : ""; | ||
| const samplerChoice = normalizeSamplerChoice( | ||
| samplerOptions, | ||
| restoredSampler ?? samplerChoices[samplerModelKey], |
There was a problem hiding this comment.
Clear the restored sampler after applying it
When a recipe has been restored, restoredSampler permanently takes precedence over every entry in the per-model map; the only clearing path is manually changing the sampler. After the restored model becomes available—and even after generating—switching to another SDXL checkpoint therefore reuses the restored sampler instead of that checkpoint's remembered choice, contradicting the per-model behavior and potentially running an unintended scheduler. Consume or scope the restored override once its target model's options become available.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa4cbf5: a restore with the model loaded stores the choice for that model directly; one made while unloaded is used by the next Generate, stored for the recalled model and then dropped.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
#13612) - diffusion.py: read pipe.scheduler with getattr on the generate path, like the status poll. #13569 made every generate touch it, which broke 173 test_diffusion_backend tests whose fake pipelines have none. - test_diffusion_autoopt_parity: skip the two fixture comparisons when diffusers is not installed (Backend CI); without it nothing compiles and every case differs. - Format three files from #13610 and #13531. - Raise the startup budget by the 0.8 KB transfer five merges added.
) #13569 made restoreSettings re-apply the restored sampler through changeSamplerChoice / samplerOptions. The test evaluates the callback in a sandbox that only knew a fixed list of closure names, so it threw ReferenceError before reaching the negative prompt and fails on main on every OS. Resolve any non-global name to a recording no-op instead.
…rity fixture with diffusers (#13608) * Studio images: read the scheduler like the status poll does, and fix the tests #13569 left red generate passed pipe.scheduler straight to build_scheduler, so a pipeline without a scheduler attribute failed every request, even with the default sampler. Read it with getattr like the status endpoint; build_scheduler already treats None as offering no samplers. The negative-prompt restore test evaluates restoreSettings in a stub scope, which now also needs the sampler names #13569 added. The auto-optimizer parity fixture records real diffusers classes, so it can only pass where diffusers is installed. Skip it without diffusers and run it in the Studio VAE seam guard job, which installs the pinned diffusers. * Tests: pin the Triton probes in the autoopt parity snapshot, and expect no titlebar blur The flux2 fp16 RoPE and Wan fused gates ask whether Triton imports. CPU torch from pip has no Triton, so the seam guard job lost both patches that the fixture records; pin them like the other host probes. #13577 made popup backdrops dim without blurring, the titlebar's included, so the titlebar smoke now expects no backdrop filter.
Fixes #11714
What this does
The Images page had no way to choose a sampler: every SDXL generation ran on whatever scheduler the base repo ships (Euler,
leadingspacing). This adds a Sampler control with the samplers people actually name on model cards, plus a Schedule type beside it, and fixes v-prediction SDXL checkpoints, which currently render as noise.1. Sampler and Schedule type (diffusers engine, SDXL)
EulerDiscreteSchedulerEulerAncestralDiscreteSchedulerDPMSolverMultistepScheduler(algorithm_type="dpmsolver++")DPMSolverMultistepScheduler(algorithm_type="sde-dpmsolver++")Schedule type: Automatic (AUTOMATIC1111's per-sampler default: Karras for DPM++ 2M, Exponential for DPM++ 2M SDE, else the model's), Uniform, Karras, Exponential. A sampler only lists the schedule types it supports (Euler a has none of the sigma flags).
_compatibles), so FLUX, Qwen-Image, Z-Image and every other flow-matching model, and the native and MLX engines, see no change.[999, 999, 998, ...]) and the SDXL ControlNet pipeline never sets a begin index, so DPM++ otherwise overran its sigmas with anIndexError.sampler,schedule_type), shown in the recipe popover ("DPM++ 2M Karras"), restored by "Restore these settings", and written to the PNGparameterstext asSampler: DPM++ 2M, Schedule type: Karraslike AUTOMATIC1111.2. v-prediction SDXL checkpoints
Single-file SDXL checkpoints trained with v-prediction (NoobAI-XL V-Pred and its merges) mark themselves with empty
v_pred/ztsnrtensors in the safetensors header, which is how ComfyUI detects them (comfy/supported_models.py,SDXL.model_type). Studio loads the single file against the SDXL base repo's epsilon scheduler and never looked at those markers, so these checkpoints produced pure noise. The loader now reads the header and setsprediction_type="v_prediction", plusrescale_betas_zero_snr=Trueandtimestep_spacing="trailing"forztsnr. Unmarked checkpoints are untouched.Reproduced with
Laxhar/noobai-XL-Vpred-1.0(NoobAI-XL-Vpred-v1.0.safetensors), same seed, 28 steps, CFG 5, through Studio's diffusion backend:prediction_type=epsilon,leadingprediction_type=v_prediction, zero SNR,trailingNot included
Samplers for flow-matching models (diffusers only partially supports them), the native sd.cpp engine's sampler flags, and Clip skip. Clip skip is not needed for SDXL: diffusers and ComfyUI already use the penultimate CLIP layer for SDXL, which is what "clip skip 2" means on Pony and Illustrious model cards.
Tests
studio/backend/tests/test_diffusion_sampler.py: sampler list per scheduler (SDXL offers them, flow matching offers none), schedule resolution, prediction settings carry over, refusals, v-pred / ztsnr markers (and idempotence),parameterstext, route refusal on other engines.studio/frontend/tests/images-sampler-choice.test.ts: request fields, fallback for a choice the model lacks, per-model memory, recipe label.Before / after in Studio
Same clicks on both sides (merge base vs this branch, two separate installs): load
NoobAI-XL-Vpred-v1.0.safetensorsas a single file, type the prompt, seed 42, page defaults (25 steps, CFG 7), Generate.Settings column: the Sampler row appears (Model default / Automatic) only on the branch.
Result: main renders noise from the v-prediction checkpoint, the branch renders the image. Mean neighbouring-pixel difference 7.91 (noise) vs 1.81.