Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cog] some minor fixes and nits #9466

Merged
merged 8 commits into from
Sep 23, 2024
Merged
Changes from 4 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
25 changes: 16 additions & 9 deletions src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def __init__(
self.register_modules(
tokenizer=tokenizer, text_encoder=text_encoder, vae=vae, transformer=transformer, scheduler=scheduler
)
self.latents_in_channels = (
self.transformer.config.in_channels
if hasattr(self, "transformer") and self.transformer is not None
else 16
sayakpaul marked this conversation as resolved.
Show resolved Hide resolved
)
self.vae_scale_factor_spatial = (
2 ** (len(self.vae.config.block_out_channels) - 1) if hasattr(self, "vae") and self.vae is not None else 8
)
Expand Down Expand Up @@ -657,14 +662,16 @@ def __call__(

# 1. Check inputs. Raise error if not correct
self.check_inputs(
prompt,
height,
width,
strength,
negative_prompt,
callback_on_step_end_tensor_inputs,
prompt_embeds,
negative_prompt_embeds,
prompt=prompt,
height=height,
width=width,
strength=strength,
negative_prompt=negative_prompt,
callback_on_step_end_tensor_inputs=callback_on_step_end_tensor_inputs,
video=video,
latents=latents,
prompt_embeds=prompt_embeds,
negative_prompt_embeds=negative_prompt_embeds,
)
self._guidance_scale = guidance_scale
self._interrupt = False
Expand Down Expand Up @@ -709,7 +716,7 @@ def __call__(
video = self.video_processor.preprocess_video(video, height=height, width=width)
video = video.to(device=device, dtype=prompt_embeds.dtype)

latent_channels = self.transformer.config.in_channels
latent_channels = self.latents_in_channels
latents = self.prepare_latents(
video,
batch_size * num_videos_per_prompt,
Expand Down
Loading