Skip to content

feat(studio): complete embedded image recipe and Recipe popover - #12091

Merged
danielhanchen merged 7 commits into
unslothai:mainfrom
Souravrajvi0:feat/image-recipe-settings-28dd
Oct 1, 2026
Merged

danielhanchen merged 7 commits into
unslothai:mainfrom
Souravrajvi0:feat/image-recipe-settings-28dd

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #11981

Summary

  • Stamp schema_version: 1 on every new PNG unsloth recipe chunk.
  • Persist the engaged speed profile, attention backend, step cache, and CPU offload from the diffusion backend into the saved recipe (alongside the existing build/precision fields).
  • Expand the Images Recipe popover to show workflow (Create / Edit / Transform / …), workflow-specific scalars (strength, upscale, references, localized edit mode), LoRAs, ControlNet, and the new runtime build fields.
  • Align the OpenAI images route gallery persist path with the main /images/generate recipe fields where they were missing.

Notes

  • All new recipe keys remain optional for listing; _REQUIRED_META is unchanged so older PNGs still appear in the gallery.
  • The A1111-style parameters string is untouched for cross-tool interop.
  • Drag-and-drop restore from PNG (called out as follow-up in the issue) is intentionally out of scope.

Before / after

The same gallery PNG (full recipe: img2img at strength 0.55, speed default, cuDNN attention, FBCache, CPU offload, one LoRA) opened in the Recipe popover on main and on this branch.

Recipe popover before and after

Persist engaged speed, attention, step cache, and CPU offload in PNG
recipes with schema_version 1, and surface workflow-specific settings,
LoRAs, and ControlNet in the Images Recipe popover.
Souravrajvi0 and others added 2 commits September 27, 2026 06:36
Exercise generate -> gallery list -> PNG download and assert engaged
runtime build fields round-trip in the embedded unsloth chunk.
@danielhanchen

Copy link
Copy Markdown
Member

Review record for #12091, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#308.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 60170e6f6 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+          <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />
+          {image.strength != null &&
+          (image.workflow === "img2img" ||
+            image.workflow === "edit" ||
+            image.workflow === "inpaint" ||
+            image.workflow === "upscale") ? (
+            <RecipeRow label="Strength" value={String(image.strength)} />
+          ) : null}
+          {image.upscale != null && image.workflow === "upscale" ? (
+            <RecipeRow label="Upscale" value={`${image.upscale}×`} />
+          ) : null}
+          {image.reference_image_count != null &&
+          (image.workflow === "reference" || image.workflow === "edit") ? (
+            <RecipeRow label="References" value={String(image.reference_image_count)} />

P2 Badge Show the reference resolution in the recipe

For Reference or unified Edit generations, the selectable reference_resolution changes how conditioning images are preprocessed and is persisted as image.reference_resolution (and even restored by restoreSettings), but this popover renders only the additional-image count. Consequently, runs using different Reference detail values can appear to have identical recipes; render the persisted resolution for these workflows as well.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing this here: reference_resolution is already persisted in the PNG and restored, nothing is lost or shown wrong. The issue scopes the popover to strength, upscale, reference count and edit mode; more rows can follow separately.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}

P2 Badge Include the ControlNet guidance interval

When an API caller sets non-default guidance_start or guidance_end, those values affect which denoising steps use ControlNet and are persisted separately in image.controlnet_guidance; image.controlnet contains only the id, type, and strength. Rendering only this row therefore makes materially different ControlNet runs look identical in the Recipe popover, so the saved interval should also be displayed.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing this here: controlnet_guidance is persisted in the recipe already, so no data is lost and nothing shown is wrong. Showing the interval is a display addition outside this issue's scope.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+          <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />

P2 Badge Avoid labeling unknown legacy workflows as Create

For legacy PNGs, workflow may be absent—GalleryImage.workflow is optional and the gallery's required metadata deliberately excludes it—so this unconditional row passes undefined to recipeWorkflowLabel, which returns “Create.” Older inpaint, transform, or edit images are therefore presented with a false workflow; omit the row or display an unknown/legacy value when workflow is absent.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not reachable: /images/generate has persisted workflow since image generation shipped (#6763); the only records without it come from the OpenAI images route, which takes no init or mask image and is always text-to-image, so Create is correct for them.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />

P2 Badge Exclude disabled LoRAs from the displayed recipe

When an API client supplies a LoRA with the valid weight 0, both generation engines filter that adapter out before rendering, but the route persists every requested entry and this new row displays the resulting id:0 as a used LoRA. The Recipe popover consequently claims that a disabled adapter affected the image; filter zero-weight entries before persisting or rendering them.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: the Studio UI drops zero-weight rows before sending, and for an API caller the row reads id:0, so the weight shown is the one recorded. Nothing is claimed beyond what was requested.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+          <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />
+          {image.strength != null &&
+          (image.workflow === "img2img" ||
+            image.workflow === "edit" ||
+            image.workflow === "inpaint" ||
+            image.workflow === "upscale") ? (

P2 Badge Include strength for outpaint recipes

For an outpaint request with an explicit non-default strength, the route runs the request through the inpaint backend and persists that strength, but this workflow allowlist excludes outpaint. Such Extend recipes therefore hide a parameter that materially affected denoising; include outpaint alongside inpaint in this condition.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: Extend from the UI always runs at strength 1 (blank border redrawn fully), so the row would show a constant. A hand-crafted API outpaint with another strength is outside this display's scope; the value stays in the recipe.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+          <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />
+          {image.strength != null &&

P2 Badge Persist the effective denoise strength

When a /images/generate caller omits strength for img2img, inpaint, or upscale, the backend still applies a pipeline default (and explicitly uses 0.35 for upscale), but the route persists request.strength as null. This new condition then hides Strength entirely, so the Recipe popover omits a scalar that affected the output; return and persist strength_applied from DiffusionBackend.generate rather than gating on the original request value.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: the Studio UI always sends strength for Transform, Inpaint, Extend and Upscale, so the row shows the value that ran. Persisting request.strength predates this PR; an API caller omitting it gets no row, which is not a wrong value.

chatgpt-codex-connector[bot] on studio/frontend/src/features/images/images-page.tsx (on the mirror)

@@ -1156,9 +1161,55 @@ function RecipePopover({
               value={memoryRecipeValue(image.memory_mode, image.offload_policy)}
             />
           ) : null}
+          {image.speed_mode ? (
+            <RecipeRow
+              label="Speed"
+              value={formatResolvedValue("speed_mode", image.speed_mode)}
+            />
+          ) : null}
+          {image.attention_backend ? (
+            <RecipeRow
+              label="Attention"
+              value={formatResolvedValue("attention_backend", image.attention_backend)}
+            />
+          ) : null}
+          {image.transformer_cache ? (
+            <RecipeRow
+              label="Step cache"
+              value={formatResolvedValue("transformer_cache", image.transformer_cache)}
+            />
+          ) : null}
+          {image.cpu_offload ? (
+            <RecipeRow label="CPU offload" value={formatResolvedValue("cpu_offload", true)} />
+          ) : null}
           {image.baked_loras?.length ? (
             <RecipeRow label="Baked" value={image.baked_loras.join(", ")} wrap />
           ) : null}
+          {image.loras?.length ? (
+            <RecipeRow label="LoRAs" value={image.loras.join(", ")} wrap />
+          ) : null}
+          {image.controlnet ? <RecipeRow label="ControlNet" value={image.controlnet} wrap /> : null}
+          <RecipeRow label="Workflow" value={recipeWorkflowLabel(image.workflow)} />
+          {image.strength != null &&
+          (image.workflow === "img2img" ||
+            image.workflow === "edit" ||
+            image.workflow === "inpaint" ||
+            image.workflow === "upscale") ? (
+            <RecipeRow label="Strength" value={String(image.strength)} />
+          ) : null}
+          {image.upscale != null && image.workflow === "upscale" ? (
+            <RecipeRow label="Upscale" value={`${image.upscale}×`} />

P2 Badge Display the capped upscale factor

For an upscale whose requested factor would exceed the backend's 2048px limit, DiffusionBackend.generate reduces the output dimensions and recalculates the effective factor (for example, 1024px at 4× becomes 2048px, or 2×), while persistence still stores request.upscale. This new row therefore reports “4×” even though only 2× ran; persist the backend's effective upscale value before displaying it.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: the row records the factor the user chose, which is what Restore re-applies and reproduces the same capped output; the Size row beside it already shows the real output dimensions.

chatgpt-codex-connector[bot] on studio/backend/routes/inference.py (on the mirror)

@@ -42325,7 +42325,7 @@ async def generate_diffusion_image(
                     strength = request.strength,
                     upscale = request.upscale,
                     reference_images = request.reference_images,
-                    workflow = request.workflow,
+                    workflow = None if request.workflow == "outpaint" else request.workflow,

P2 Badge Validate outpaint inputs before erasing the workflow

When an API caller sets workflow: "outpaint" without both init_image and mask_image, this conversion removes the only indication that outpaint was requested, so the backend successfully infers txt2img or img2img instead of rejecting the malformed request. This contradicts the new request-field contract that outpaint runs over a padded source and mask; validate those required inputs before passing None to the backend.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: a caller sending workflow outpaint without a source and mask is malformed input; the backend then runs and records the workflow it actually inferred (outpaint is only recorded when the run was inpaint), so nothing is mislabelled.

Round 2: reviewed mirror 0ed0ed2d14 (this PR's 6ad4c625c)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 0ed0ed2d14

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 0ed0ed2d14 (this PR's 6ad4c625c).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@danielhanchen
danielhanchen merged commit 16c1129 into unslothai:main Oct 1, 2026
49 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Unsloth Studio / Desktop: store the full generation settings in each image and show the workflow in Recipe

2 participants