Files
HM-RunningHub-ComfyUI_RH_He…/nodes/v2v.py
T
wenjian 872011d8f1 Add ComfyUI node integration and fix compatibility issues
- Add ComfyUI custom nodes: model loader, t2v, i2v, v2v
- Fix kernels import: move to try block for graceful fallback when not installed
- Fix diffusers compatibility: add fallback imports for HeliosLoraLoaderMixin,
  HeliosTransformer3DModel, HeliosScheduler, and apply_lora_scale
- Fix infer_helios: cast num_blocks_per_group to int, add low_cpu_mem_usage
- Add rh_config.json, model index compat, and deployment scripts

Made-with: Cursor
2026-03-10 04:49:22 +08:00

81 lines
3.1 KiB
Python

import torch
from .utils import (
comfyui_images_to_pil_list,
estimate_total_steps,
helios_output_to_video,
make_progress_callback,
parse_pyramid_steps,
)
class RunningHubHeliosV2V:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"helios_pipe": ("HELIOS_PIPE",),
"video_frames": ("IMAGE",),
"prompt": ("STRING", {"default": "", "multiline": True}),
"width": ("INT", {"default": 640, "min": 128, "max": 1920, "step": 16}),
"height": ("INT", {"default": 384, "min": 128, "max": 1088, "step": 16}),
"num_frames": ("INT", {"default": 99, "min": 1, "max": 480, "step": 1}),
"num_inference_steps": ("INT", {"default": 50, "min": 1, "max": 200, "step": 1}),
"guidance_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 20.0, "step": 0.1}),
"seed": ("INT", {"default": 42, "min": 0, "max": 0xFFFFFFFF}),
"is_enable_stage2": ("BOOLEAN", {"default": True}),
"pyramid_steps": ("STRING", {"default": "2,2,2"}),
"is_amplify_first_chunk": ("BOOLEAN", {"default": True}),
},
"optional": {
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
},
}
RETURN_TYPES = ("VIDEO",)
RETURN_NAMES = ("video",)
FUNCTION = "generate"
CATEGORY = "RunningHub/Helios"
def generate(self, helios_pipe, video_frames, prompt, width, height, num_frames,
num_inference_steps, guidance_scale, seed,
is_enable_stage2, pyramid_steps, is_amplify_first_chunk,
negative_prompt=""):
pipe = helios_pipe
pyramid_list = parse_pyramid_steps(pyramid_steps)
total_steps = estimate_total_steps(
num_frames, num_inference_steps, is_enable_stage2,
pyramid_list, is_amplify_first_chunk,
)
progress_callback = make_progress_callback(total_steps)
pil_frames = comfyui_images_to_pil_list(video_frames)
with torch.no_grad():
output = pipe(
prompt=prompt,
negative_prompt=negative_prompt if negative_prompt else None,
height=height,
width=width,
num_frames=num_frames,
num_inference_steps=num_inference_steps,
guidance_scale=guidance_scale,
generator=torch.Generator(device="cuda").manual_seed(seed),
history_sizes=[16, 2, 1],
num_latent_frames_per_chunk=9,
keep_first_frame=True,
is_enable_stage2=is_enable_stage2,
pyramid_num_inference_steps_list=pyramid_list,
is_skip_first_chunk=False,
is_amplify_first_chunk=is_amplify_first_chunk,
use_zero_init=False,
zero_steps=1,
image=None,
video=pil_frames,
callback_on_step_end=progress_callback,
)
video = helios_output_to_video(output)
return (video,)