Skip to content

Commit

Permalink
fix(api): handle mixed tensors for ControlNet on CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Apr 15, 2023
1 parent 161913b commit 3196535
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/onnx_web/diffusers/pipelines/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ def prepare_latents(
latents = generator.randn(*shape).astype(dtype)

# scale the initial noise by the standard deviation required by the scheduler
latents = latents * self.scheduler.init_noise_sigma
sigma = self.scheduler.init_noise_sigma
if torch.is_tensor(sigma):
sigma = sigma.numpy()

latents = latents * sigma
return latents

# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs
Expand Down

0 comments on commit 3196535

Please sign in to comment.