Use main diffusers 0.30.0

This commit is contained in:
kijai 2024-08-07 12:01:10 +03:00
parent 2ae70dd82e
commit 72c6ad996a
5 changed files with 13 additions and 12 deletions

View File

@ -130,7 +130,7 @@
"Node name for S&R": "CogVideoTextEncode" "Node name for S&R": "CogVideoTextEncode"
}, },
"widgets_values": [ "widgets_values": [
"bad quality video, blurry, messy" ""
] ]
}, },
{ {
@ -163,7 +163,7 @@
"Node name for S&R": "DownloadAndLoadCogVideoModel" "Node name for S&R": "DownloadAndLoadCogVideoModel"
}, },
"widgets_values": [ "widgets_values": [
"fp16" "bf16"
] ]
}, },
{ {

View File

@ -285,7 +285,7 @@
"Node name for S&R": "DownloadAndLoadCogVideoModel" "Node name for S&R": "DownloadAndLoadCogVideoModel"
}, },
"widgets_values": [ "widgets_values": [
"fp16" "bf16"
] ]
}, },
{ {

View File

@ -2,6 +2,7 @@ import os
import torch import torch
import folder_paths import folder_paths
import comfy.model_management as mm import comfy.model_management as mm
from comfy.utils import ProgressBar
from diffusers.schedulers import CogVideoXDDIMScheduler, CogVideoXDPMScheduler from diffusers.schedulers import CogVideoXDDIMScheduler, CogVideoXDPMScheduler
from diffusers.models import AutoencoderKLCogVideoX, CogVideoXTransformer3DModel from diffusers.models import AutoencoderKLCogVideoX, CogVideoXTransformer3DModel
from .pipeline_cogvideox import CogVideoXPipeline from .pipeline_cogvideox import CogVideoXPipeline
@ -24,7 +25,7 @@ class DownloadAndLoadCogVideoModel:
"fp32", "fp32",
"bf16", "bf16",
], ],
{"default": "fp16"}, {"default": "bf16"},
), ),
}, },
} }
@ -286,14 +287,16 @@ class CogVideoDecode:
latents = 1 / vae.config.scaling_factor * latents latents = 1 / vae.config.scaling_factor * latents
frames = [] frames = []
pbar = ProgressBar(num_seconds)
for i in range(num_seconds): for i in range(num_seconds):
# Whether or not to clear fake context parallel cache
fake_cp = i + 1 < num_seconds
start_frame, end_frame = (0, 3) if i == 0 else (2 * i + 1, 2 * i + 3) start_frame, end_frame = (0, 3) if i == 0 else (2 * i + 1, 2 * i + 3)
current_frames = vae.decode(latents[:, :, start_frame:end_frame], fake_cp=fake_cp).sample current_frames = vae.decode(latents[:, :, start_frame:end_frame]).sample
frames.append(current_frames) frames.append(current_frames)
mm.soft_empty_cache()
pbar.update(1)
vae.clear_fake_context_parallel_cache()
vae.to(offload_device) vae.to(offload_device)
mm.soft_empty_cache()
frames = torch.cat(frames, dim=2) frames = torch.cat(frames, dim=2)
video = pipeline["pipe"].video_processor.postprocess_video(video=frames, output_type="pt") video = pipeline["pipe"].video_processor.postprocess_video(video=frames, output_type="pt")

View File

@ -1,8 +1,6 @@
# WORK IN PROGRESS # WORK IN PROGRESS
Currently requires diffusers with PR: https://github.com/huggingface/diffusers/pull/9082 Requires diffusers 0.30.0 (this is specified in requirements.txt)
This is specified in requirements.txt
https://github.com/user-attachments/assets/9e41f37b-2bb3-411c-81fa-e91b80da2559 https://github.com/user-attachments/assets/9e41f37b-2bb3-411c-81fa-e91b80da2559

View File

@ -1,2 +1,2 @@
huggingface_hub huggingface_hub
git+https://github.com/huggingface/diffusers.git@878f609aa5ce4a78fea0f048726889debde1d7e8#egg=diffusers diffusers>=0.30.0