summaryrefslogtreecommitdiff
path: root/candle-examples/examples
diff options
context:
space:
mode:
authorNick Senger <dev@nsenger.com>2025-01-01 12:34:17 -0800
committerGitHub <noreply@github.com>2025-01-01 21:34:17 +0100
commitcbaa0ad46f0eda2f3d9bcf8a42d6271e6760e578 (patch)
treef8a899e47e907bcf79f877e0cb307d2b5d57db1f /candle-examples/examples
parentb12c7c2888c49e7f133bb2dc29f8fdbb04a37e10 (diff)
downloadcandle-cbaa0ad46f0eda2f3d9bcf8a42d6271e6760e578.tar.gz
candle-cbaa0ad46f0eda2f3d9bcf8a42d6271e6760e578.tar.bz2
candle-cbaa0ad46f0eda2f3d9bcf8a42d6271e6760e578.zip
UniPC for diffusion sampling (#2684)
* feat: Add unipc multistep scheduler * chore: Clippy and formatting * chore: Update comments * chore: Avoid unsafety in float ordering * refactor: Update Scheduler::step mutability requirements * fix: Corrector img2img * chore: Update unipc ref link to latest diffusers release * chore: Deduplicate float ordering * fix: Panic when running with dev profile
Diffstat (limited to 'candle-examples/examples')
-rw-r--r--candle-examples/examples/stable-diffusion/main.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/candle-examples/examples/stable-diffusion/main.rs b/candle-examples/examples/stable-diffusion/main.rs
index b6585afa..ebf0bfcb 100644
--- a/candle-examples/examples/stable-diffusion/main.rs
+++ b/candle-examples/examples/stable-diffusion/main.rs
@@ -477,7 +477,7 @@ fn run(args: Args) -> Result<()> {
),
};
- let scheduler = sd_config.build_scheduler(n_steps)?;
+ let mut scheduler = sd_config.build_scheduler(n_steps)?;
let device = candle_examples::device(cpu)?;
if let Some(seed) = seed {
device.set_seed(seed)?;
@@ -539,7 +539,7 @@ fn run(args: Args) -> Result<()> {
};
for idx in 0..num_samples {
- let timesteps = scheduler.timesteps();
+ let timesteps = scheduler.timesteps().to_vec();
let latents = match &init_latent_dist {
Some(init_latent_dist) => {
let latents = (init_latent_dist.sample()? * vae_scale)?.to_device(&device)?;