Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ def get_timesteps(self, num_inference_steps, strength, device):
return timesteps, num_inference_steps - t_start

def prepare_latents(self, image, timestep, batch_size, num_images_per_prompt, dtype, device, generator=None):
if not isinstance(image, (torch.Tensor, PIL.Image.Image, list)):
raise ValueError(
f"`image` has to be of type `torch.Tensor`, `PIL.Image.Image` or list but is {type(image)}"
)

image = image.to(device=device, dtype=dtype)

batch_size = batch_size * num_images_per_prompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ def get_timesteps(self, num_inference_steps, strength, device):

# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.StableDiffusionImg2ImgPipeline.prepare_latents
def prepare_latents(self, image, timestep, batch_size, num_images_per_prompt, dtype, device, generator=None):
if not isinstance(image, (torch.Tensor, PIL.Image.Image, list)):
raise ValueError(
f"`image` has to be of type `torch.Tensor`, `PIL.Image.Image` or list but is {type(image)}"
)

image = image.to(device=device, dtype=dtype)

batch_size = batch_size * num_images_per_prompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ def get_timesteps(self, num_inference_steps, strength, device):
return timesteps, num_inference_steps - t_start

def prepare_latents(self, image, timestep, batch_size, num_images_per_prompt, dtype, device, generator=None):
if not isinstance(image, (torch.Tensor, PIL.Image.Image, list)):
raise ValueError(
f"`image` has to be of type `torch.Tensor`, `PIL.Image.Image` or list but is {type(image)}"
)

image = image.to(device=device, dtype=dtype)

batch_size = batch_size * num_images_per_prompt
Expand Down