Skip to content

Commit

Permalink
Remove duplicate checks for len(generator) != batch_size when generat…
Browse files Browse the repository at this point in the history
…or is a list (#10134)

remove duplicate checks
  • Loading branch information
a-r-r-o-w authored Dec 6, 2024
1 parent bf64b32 commit 18f9b99
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,6 @@ def prepare_latents(
self.vae.to(dtype=torch.float32)

if isinstance(generator, list):
if len(generator) != batch_size:
raise ValueError(
f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
f" size of {batch_size}. Make sure the batch size matches the length of the generators."
)

init_latents = [
self.encode_video(video[i], generator[i], decode_chunk_size).unsqueeze(0)
for i in range(batch_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,6 @@ def prepare_latents(
self.vae.to(dtype=torch.float32)

if isinstance(generator, list):
if len(generator) != batch_size:
raise ValueError(
f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
f" size of {batch_size}. Make sure the batch size matches the length of the generators."
)

init_latents = [
self.encode_video(video[i], generator[i], decode_chunk_size).unsqueeze(0)
for i in range(batch_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,6 @@ def prepare_latents(

if latents is None:
if isinstance(generator, list):
if len(generator) != batch_size:
raise ValueError(
f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
f" size of {batch_size}. Make sure the batch size matches the length of the generators."
)

init_latents = [
retrieve_latents(self.vae.encode(video[i].unsqueeze(0)), generator[i]) for i in range(batch_size)
]
Expand Down

0 comments on commit 18f9b99

Please sign in to comment.