| .sd_generate_plan | R Documentation |
Mirrors the routing logic of sd_generate (cfg auto-1.0 for
guidance-distilled Flux/Flux.2, strategy selection, VAE tiling resolution)
but instead of running the pipeline, returns a list of steps. Each
step is one of:
type = "gen" — a single sd_generate_async() call.
Carries a ready-to-use params list, width/height,
a label, and uses_init (whether it consumes the previous
step's image as init_image).
type = "upscale" — a synchronous R-side resize/ESRGAN step
run between two gen steps. Carries width/height,
upscaler, upscale_factor.
The final step (the image returned to the caller) has final = TRUE.
.sd_generate_plan(
ctx,
prompt,
negative_prompt = "",
width = 512L,
height = 512L,
init_image = NULL,
strength = 0.75,
sample_method = SAMPLE_METHOD$EULER,
sample_steps = 20L,
cfg_scale = 7,
seed = 42L,
batch_count = 1L,
scheduler = SCHEDULER$DISCRETE,
clip_skip = -1L,
eta = 0,
flow_shift = NULL,
hr_strength = 0.4,
hr_steps = NULL,
upscaler = NULL,
upscale_factor = 4L,
vae_mode = "auto",
vae_auto_threshold = 1048576L,
vae_tile_size = 64L,
vae_tile_overlap = 0.25,
cache_mode = c("off", "easy", "ucache"),
cache_config = NULL
)
ctx |
SD context created by |
prompt |
Text prompt describing desired image |
negative_prompt |
Negative prompt (default "") |
width |
Image width in pixels (default 512) |
height |
Image height in pixels (default 512) |
init_image |
Optional init image for img2img. If provided, runs img2img
instead of txt2img. Requires |
strength |
Denoising strength for img2img (default 0.75). Ignored for txt2img. |
sample_method |
Sampling method (see |
sample_steps |
Number of sampling steps (default 20) |
cfg_scale |
Classifier-free guidance scale (default 7.0) |
seed |
Random seed (-1 for random) |
batch_count |
Number of images to generate (default 1) |
scheduler |
Scheduler type (see |
clip_skip |
Number of CLIP layers to skip (-1 = auto) |
eta |
Eta parameter for DDIM-like samplers |
flow_shift |
Flow shift for flow-matching models (Flux, SD3). |
hr_strength |
Denoising strength for highres fix refinement pass (default 0.4). Only used when auto-routing selects highres fix. |
vae_mode |
VAE processing mode: |
vae_tile_size |
Tile size for VAE tiling (default 64) |
vae_tile_overlap |
Overlap for VAE tiling (default 0.25) |
cache_mode |
Step caching mode: |
cache_config |
Optional fine-tuned cache config from
|
This lets the Shiny GUI drive the multi-step highres-fix pipeline through the single-shot async engine: run a gen step, poll it, feed its result into the next step, all without blocking the R session.
List of step descriptors (see above).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.