sd_preview_start: Enable live generation previews

View source: R/preview.R

sd_preview_startR Documentation

Enable live generation previews

Description

Installs the preview callback so that, during the next generation, the most recent intermediate frame is written to path (a single PPM file, updated atomically). Poll it with sd_read_preview. Call sd_preview_stop when done.

Usage

sd_preview_start(path, mode = PREVIEW$PROJ, interval = 1L, denoised = TRUE)

Arguments

path

File path for the preview PPM (e.g. a tempfile).

mode

Decode mode, one of PREVIEW: "proj" (fast, rough), "tae" (tiny autoencoder; needs taesd_path in sd_ctx), "vae" (full VAE; slow). Default "proj".

interval

Emit a preview every N sampling steps (default 1).

denoised

If TRUE (default), preview the denoised estimate; otherwise the noisy latent.

Details

Most users pass preview = TRUE to sd_generate instead, which wires this up automatically.

Value

Invisibly, path.

See Also

sd_read_preview, sd_preview_stop


sd2R documentation built on June 19, 2026, 9:08 a.m.