| sd_generate_multi_gpu | R Documentation |
Distributes prompts across available Vulkan GPUs, running one process per
GPU via callr. Each process creates its own sd_ctx and
calls sd_generate. Requires the callr package.
sd_generate_multi_gpu(
model_path = NULL,
prompts,
negative_prompt = "",
devices = NULL,
seeds = NULL,
width = 512L,
height = 512L,
model_type = "sd1",
vram_gb = NULL,
vae_decode_only = TRUE,
progress = TRUE,
diffusion_model_path = NULL,
vae_path = NULL,
clip_l_path = NULL,
t5xxl_path = NULL,
...
)
model_path |
Path to the model file (single-file models like SD 1.x/2.x/SDXL) |
prompts |
Character vector of prompts (one image per prompt) |
negative_prompt |
Negative prompt applied to all images (default "") |
devices |
Integer vector of Vulkan device indices (0-based). Default
|
seeds |
Integer vector of seeds, same length as |
width |
Image width (default 512) |
height |
Image height (default 512) |
model_type |
Model type (default "sd1") |
vram_gb |
VRAM per GPU for auto-routing (default NULL) |
vae_decode_only |
VAE decode only (default TRUE) |
progress |
Print progress messages (default TRUE) |
diffusion_model_path |
Path to diffusion model (Flux/multi-file models) |
vae_path |
Path to VAE model |
clip_l_path |
Path to CLIP-L model |
t5xxl_path |
Path to T5-XXL model |
... |
Additional arguments passed to |
List of SD images, one per prompt, in original order.
Release any existing SD context (rm(ctx); gc()) before calling
this function. Holding a Vulkan context in the main process while
subprocesses try to use the same GPU can produce corrupted (grey) images.
## Not run:
# Single-file model (SD 1.x/2.x/SDXL)
imgs <- sd_generate_multi_gpu(
"model.safetensors",
prompts = c("a cat", "a dog", "a bird", "a fish"),
devices = 0:1
)
# Multi-file model (Flux)
imgs <- sd_generate_multi_gpu(
diffusion_model_path = "flux1-dev-Q4_K_S.gguf",
vae_path = "ae.safetensors",
clip_l_path = "clip_l.safetensors",
t5xxl_path = "t5-v1_1-xxl-encoder-Q5_K_M.gguf",
prompts = c("a cat", "a dog"),
model_type = "flux", devices = 0:1
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.