View source: R/model_manager.R
| sd_load_model | R Documentation |
Loads a model by its registry id. Returns a cached context if already
loaded, otherwise creates a new sd_ctx. Additional
arguments override registry defaults.
sd_load_model(id, ...)
id |
Model identifier from registry |
... |
Additional arguments passed to |
Before loading, the estimated VRAM need (on-disk weight size times a
headroom factor plus a reserve) is compared against free GPU memory; if it
would not fit, least-recently-used models are unloaded first. If loading
still fails due to insufficient VRAM, the LRU model is unloaded and the load
is retried once. VRAM estimation/eviction is skipped when GPU memory cannot
be queried (e.g. CPU backend). Tunable via environment variables
SD2R_VRAM_HEADROOM (default 1.2) and SD2R_VRAM_RESERVE_MB
(default 512).
SD context (external pointer)
## Not run:
ctx <- sd_load_model("flux-dev")
imgs <- sd_txt2img(ctx, "a cat in space")
# Override defaults
ctx <- sd_load_model("flux-dev", vae_decode_only = FALSE, verbose = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.