diff --git a/nodes.py b/nodes.py index 42f7013..94d024a 100644 --- a/nodes.py +++ b/nodes.py @@ -542,18 +542,8 @@ class CogVideoXFunSampler: "positive": ("CONDITIONING", ), "negative": ("CONDITIONING", ), "video_length": ("INT", {"default": 49, "min": 5, "max": 49, "step": 4}), - "base_resolution": ( - [ - 256, - 320, - 384, - 448, - 512, - 768, - 960, - 1024, - ], {"default": 768} - ), + "width": ("INT", {"default": 720, "min": 256, "max": 1024, "step": 4}), + "height": ("INT", {"default": 480, "min": 256, "max": 1024, "step": 4}), "seed": ("INT", {"default": 43, "min": 0, "max": 0xffffffffffffffff}), "steps": ("INT", {"default": 50, "min": 1, "max": 200, "step": 1}), "cfg": ("FLOAT", {"default": 6.0, "min": 1.0, "max": 20.0, "step": 0.01}), @@ -584,7 +574,7 @@ class CogVideoXFunSampler: FUNCTION = "process" CATEGORY = "CogVideoWrapper" - def process(self, pipeline, positive, negative, video_length, base_resolution, seed, steps, cfg, scheduler, + def process(self, pipeline, positive, negative, video_length, width, height, seed, steps, cfg, scheduler, start_img=None, end_img=None, opt_empty_latent=None): device = mm.get_torch_device() offload_device = mm.unet_offload_device() @@ -597,8 +587,6 @@ class CogVideoXFunSampler: mm.soft_empty_cache() - aspect_ratio_sample_size = {key : [x / 512 * base_resolution for x in ASPECT_RATIO_512[key]] for key in ASPECT_RATIO_512.keys()} - if start_img is not None: start_img = [to_pil(_start_img) for _start_img in start_img] if start_img is not None else None end_img = [to_pil(_end_img) for _end_img in end_img] if end_img is not None else None @@ -607,9 +595,6 @@ class CogVideoXFunSampler: else: original_width = opt_empty_latent["samples"][0].shape[-1] * 8 original_height = opt_empty_latent["samples"][0].shape[-2] * 8 - closest_size, closest_ratio = get_closest_ratio(original_height, original_width, ratios=aspect_ratio_sample_size) - height, width = [int(x / 16) * 16 for x in closest_size] - print(f"Closest size: {width}x{height}") # Load Sampler if scheduler == "DPM++": @@ -668,18 +653,8 @@ class CogVideoXFunVid2VidSampler: "positive": ("CONDITIONING", ), "negative": ("CONDITIONING", ), "video_length": ("INT", {"default": 49, "min": 5, "max": 49, "step": 4}), - "base_resolution": ( - [ - 256, - 320, - 384, - 448, - 512, - 768, - 960, - 1024, - ], {"default": 768} - ), + "width": ("INT", {"default": 720, "min": 256, "max": 1024, "step": 4}), + "height": ("INT", {"default": 480, "min": 256, "max": 1024, "step": 4}), "seed": ("INT", {"default": 43, "min": 0, "max": 0xffffffffffffffff}), "steps": ("INT", {"default": 50, "min": 1, "max": 200, "step": 1}), "cfg": ("FLOAT", {"default": 6.0, "min": 1.0, "max": 20.0, "step": 0.01}), @@ -707,7 +682,7 @@ class CogVideoXFunVid2VidSampler: FUNCTION = "process" CATEGORY = "CogVideoWrapper" - def process(self, pipeline, positive, negative, video_length, base_resolution, seed, steps, cfg, denoise_strength, scheduler, validation_video): + def process(self, pipeline, positive, negative, video_length, width, height, seed, steps, cfg, denoise_strength, scheduler, validation_video): device = mm.get_torch_device() offload_device = mm.unet_offload_device() pipe = pipeline["pipe"] @@ -718,11 +693,8 @@ class CogVideoXFunVid2VidSampler: mm.soft_empty_cache() # Count most suitable height and width - aspect_ratio_sample_size = {key : [x / 512 * base_resolution for x in ASPECT_RATIO_512[key]] for key in ASPECT_RATIO_512.keys()} validation_video = np.array(validation_video.cpu().numpy() * 255, np.uint8) original_width, original_height = Image.fromarray(validation_video[0]).size - closest_size, closest_ratio = get_closest_ratio(original_height, original_width, ratios=aspect_ratio_sample_size) - height, width = [int(x / 16) * 16 for x in closest_size] base_path = pipeline["base_path"]