Repository navigation
Studio Images: paste generation parameters, inpaint mask blur and only-masked area, seed buttons - #14508
Studio Images: paste generation parameters, inpaint mask blur and only-masked area, seed buttons#14508danielhanchen wants to merge 35 commits into
Conversation
Optional mask_blur, inpaint_only_masked and inpaint_padding request fields (AUTOMATIC1111 Mask blur / Inpaint area: Only masked / Masked area padding). Unset keeps the plain inpaint call. Only masked uses diffusers padding_mask_crop and is reported by supports_inpaint_only_masked.
…r range Paste AUTOMATIC1111 / Forge / Civitai parameter text into the form through the same parser as image drop. The parser now reads Clip skip, CFG rescale, variation seed, hires keys, inpaint keys, JSON values and lora tags; tags select installed LoRAs and anything Studio cannot apply is listed as not applied. Adds Random and Reuse last seed buttons, inpaint mask controls, and lets the Steps slider reach models whose default is above 50.
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
for more information, see https://pre-commit.ci
…n newer images are unloaded
…ugh the soft mask
…e a LoRA model is loaded [skip ci]
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39edebbaa5
ℹ️ 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 networks = extractExtraNetworks(promptLines.join("\n").trim()); | ||
| const out: ImportedRecipe = { | ||
| prompt: promptLines.join("\n").trim(), | ||
| prompt: networks.prompt, |
There was a problem hiding this comment.
Report unsupported A1111 prompt emphasis
When an imported A1111/Civitai prompt contains standard attention syntax such as (masterpiece:1.2) or [background], this preserves the syntax and reports the prompt as applied. On the diffusers engine, DiffusionBackend.generate forwards this string directly to the pipeline and the repository has no A1111 attention parser, so the punctuation and weight are tokenized literally rather than reproducing A1111 conditioning. Translate this syntax or list prompt emphasis as not applied.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 026d85d: A1111 attention syntax in a pasted prompt or negative prompt ((x:1.2), (x), [x]; escaped brackets are literal) is now listed as prompt emphasis passed as plain text when the loaded engine does not parse it (diffusers, MLX) or no model is loaded. The prompt text is kept unchanged. The native sd.cpp engine has its own A1111 parser (parse_prompt_attention), so nothing is reported there.
… report clamped numbers
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
…thout a weight parser [skip ci]
|
@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: 026d85d7ff
ℹ️ 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".
| if (ch === "\\") { | ||
| i++; | ||
| continue; |
There was a problem hiding this comment.
Unescape A1111's literal bracket syntax
When an imported prompt contains escaped delimiters such as \(literal\) or \[literal\], the current fix skips them here but leaves the prompt text unchanged. On diffusers and MLX, which have no A1111 attention parser, those backslashes are therefore tokenized even though A1111 removes them and encodes the brackets literally; the import also emits no not-applied warning. Unescape these delimiters for non-parsing engines or report them as unsupported.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 18c5644: escaped A1111 brackets (( ) [ ]) are now listed as passed with their backslashes when the loaded engine does not parse A1111 syntax (diffusers, MLX) or no model is loaded. The prompt is kept as written, since the engine can change later; on sd.cpp nothing is reported.
There was a problem hiding this comment.
Include archived images when choosing the last seed
After the user archives their newest local image and reloads the page, sessionSeed is null and gallery contains only the active shelf because getGallery defaults to archived=false. This scan therefore selects an older active image and the “Reuse last seed” button silently uses the wrong seed. Compare against the newest archived record as well, or disable the gallery fallback when that shelf has not been considered.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6fc4725: the gallery fallback for Reuse last seed is now used only when the whole active gallery is loaded and the archive is confirmed empty (one archived=true, limit 1 request, repeated when the strip changes). With any archived image, or before that check returns, only this session's seed is offered, so an archived newest image is never skipped.

Summary
Refs #10695. This adds four Images-page items from the settings gap list.
1. Paste generation parameters
Negative prompt:, and aSteps:line with a seed, sampler or CFG) into the prompt box fills the form instead of adding the text to the prompt.parseA1111Parametersinlib/image-metadata.ts) and one restore path (applyImportedRecipe). That path also produces the "not applied" toast.modules/infotext_utils.pyparse_generation_parameters:Steps:, or 3+ fields including a known key (there_paramrule, :254-257).Civitai resources: [...],Hashes: {...}) stay whole instead of being split at their commas.Clip skip(A1111 numbering)CFG Rescale/RescaleCFG/ Forge'slatent_modifier_rescale_cfg_phiVariation seed/Variation seed strengthHires *Mask blur,Inpaint area,Masked area padding<lora:name:weight>tags (alsote=/unet=and<lyco:...>) are removed from the prompt. Each one selects the installed local LoRA with the same file name, at that weight clamped to 0-2. Tags with no match are reported as "LoRA x (not installed)". Other tags such as<hypernet:...>are removed from the prompt and reported too.Model hash,Lora hashesandVersionare read and ignored.2. Inpaint mask blur and "Only masked"
mask_blur(0-64 px): a Gaussian blur of the mask. This is what diffusersVaeImageProcessor.blurdoes.inpaint_only_maskedinpaint_padding(0-256, 32 when left out, the A1111 default). It maps to diffuserspadding_mask_crop.__call__takespadding_mask_crop. Otherwise the request gets a 400.supports_inpaint_only_maskedreports this. It is False on the native and MLX engines.3. Seed buttons
"Random" (clears the Seed field: a new random seed each run) and "Reuse last seed" sit next to Seed. Reuse fills in the base seed of this session's last run. Before any run this session, it uses the newest gallery record's seed.
4. Steps slider max
min(100, max(50, 2 x model default, current value)). 100 is the request's limit.Testing
tests/image-paste-parameters.test.tsandtests/image-seed-inpaint-steps.test.ts.<lora:...>in the prompt and drops Clip skip, CFG Rescale and Variation seed with no message.tests/image-metadata.test.ts:cfg_rescaleas its example of an unknown key. That key is now listed by label, so the example moved totiling.node --experimental-strip-types --test "tests/**/*.test.ts": 13244 tests, 0 failures.node scripts/typecheck.mjs --testsis clean.images-page.tsxhas 37 errors on both base and head, so this change adds none.tests/test_diffusion_inpaint_mask.py(CPU, 14 tests): request bounds, blur, padding, the status flag, and the route passing fields only when set.tests/test_diffusion_inpaint_mask_sdxl.py(5 tests, through Studio's realDiffusionBackendwith a tiny SDXL inpaint pipeline on GPU), which checks that:padding_mask_cropis passed.mask_blur=8changes the mask the pipeline receives, and the output.padding_mask_crop, keeps the source size, and leaves pixels away from the mask unchanged.padding_mask_cropis refused.Not covered
padding_mask_cropsupport but were not rendered.Review follow-ups
mask_blur,inpaint_only_maskedandinpaint_paddingwith a 400, like the other conditioning fields.mask_image, so with Only masked off the render is pasted back over the source through the blurred mask (A1111's apply_overlay). With Only masked on,padding_mask_cropalready overlays with the blurred mask, so it is not applied twice.<lora:...>tags before a LoRA-capable model is loaded matches the tags against the full local LoRA list instead of reporting installed adapters as missing.Recycleinstead of a HugeIcons barrel import, which kept the eager startup bundle under its budget (main + PR: 2023.3 KB transfer, over the 2023.0 KB budget; with this change 2022.9 KB). The screenshots below were taken before this swap, so they show the old icon.Screenshots: before (merge base
dff0fb917) vs after (44cf94475)Two separate
install.sh --localbuilds of Studio, one from each commit. Both load the same model: a tiny SDXL pipeline with random weights (hf-internal-testing/tiny-stable-diffusion-xl-pipe), run as familysdxlfrom a local folder whose name containskrea-2-raw. Studio looks up a model's default steps by its name, so that folder name gives a resident default of 52 steps on both sides (the backend also reportsgeneration_defaults.steps = 52). That shows the Krea-2-raw case without downloading Krea-2-raw itself. The noise image in the gallery is what random weights produce.Steps slider at a 52-step model default. Before, the slider stops at 50 and the thumb sits pinned at the end while the field reads 52. After, the slider goes up to 100 (
aria-valuemax50 -> 100) and the thumb sits at 52.Seed buttons. Before, there is only the Seed field. After, Random and Reuse last seed sit next to it. This shot was taken after one generation with seed 424242. Clicking Reuse put 424242 in the field, and the tooltip reads "Reuse last seed (424242)".
Preset menu. After, the menu has a new "Paste generation parameters" entry under "Load settings from an image".
Pasting a Civitai-style A1111 block. The block includes
<lora:sloth_style_v2:0.8>, Clip skip 2, CFG Rescale 0.7 and Variation seed 42. Before, pasting it into the prompt box drops the whole block into the prompt as plain text. After, the block goes into the Paste generation parameters dialog.The form after the paste. Before, the prompt holds the raw block, including the LoRA tag. Steps stays at 52, the size stays 1024x1024 and the seed stays empty. After:
Inpaint with a source image. Before, only Strength is shown. After, there is a Mask blur slider (0-64, default 0) and an Only masked switch, which appears because
supports_inpaint_only_maskedis true for SDXL. Turning the switch on shows a Padding slider (0-256, default 32).