sd_img2img_tiled: Tiled img2img (MultiDiffusion with init image)

View source: R/pipeline.R

sd_img2img_tiledR Documentation

Tiled img2img (MultiDiffusion with init image)

Description

Runs img2img with tiled sampling: at each denoising step the latent is split into overlapping tiles, each denoised independently, then merged. The init image provides global composition; tiles add detail.

Usage

sd_img2img_tiled(
  ctx,
  prompt,
  init_image,
  negative_prompt = "",
  width = NULL,
  height = NULL,
  sample_tile_size = NULL,
  sample_tile_overlap = 0.25,
  sample_method = SAMPLE_METHOD$EULER,
  sample_steps = 20L,
  cfg_scale = 7,
  seed = 42L,
  batch_count = 1L,
  scheduler = SCHEDULER$DISCRETE,
  clip_skip = -1L,
  strength = 0.5,
  eta = 0,
  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
)

Arguments

ctx

SD context created by sd_ctx

prompt

Text prompt describing desired image

init_image

Init image in sd_image format. Use sd_load_image to load from file.

negative_prompt

Negative prompt (default "")

width

Image width in pixels (default 512)

height

Image height in pixels (default 512)

sample_tile_size

Tile size in latent pixels (default auto from model)

sample_tile_overlap

Overlap fraction 0.0-0.5 (default 0.25)

sample_method

Sampling method (see SAMPLE_METHOD)

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 SCHEDULER)

clip_skip

Number of CLIP layers to skip (-1 = auto)

strength

Denoising strength (0.0 = no change, 1.0 = full denoise, default 0.75)

eta

Eta parameter for DDIM-like samplers

vae_mode

VAE processing mode: "normal" (no tiling), "tiled" (always tile), or "auto" (VRAM-aware: queries free GPU memory via Vulkan and compares against estimated peak VAE usage; tiles only when VRAM is insufficient). Default "auto".

vae_auto_threshold

Pixel area fallback threshold for vae_mode = "auto" when VRAM query is unavailable (no Vulkan, CPU backend, etc.). Tiling activates when width * height exceeds this value. Default 1048576L (1024x1024 pixels).

vae_tile_size

Tile size in latent pixels for tiled VAE (default 64). Ignored when vae_tile_rel_x/vae_tile_rel_y are set.

vae_tile_overlap

Overlap ratio between tiles, 0.0-0.5 (default 0.25)

cache_mode

Step caching mode: "off" (default), "easy" (EasyCache — skips redundant denoising steps), or "ucache" (UCache). Can speed up sampling 20-40% with minor quality impact.

cache_config

Optional fine-tuned cache config from sd_cache_params. Overrides cache_mode when provided.

Value

List of SD images


sd2R documentation built on March 30, 2026, 5:08 p.m.