Skip to content

[FR] Please support ref image and multiple control videos in Wan VACE #11674

Description

@nitinmukesh

Is your feature request related to a problem? Please describe.
Not a problem but a good feature to be supported in Wan Vace pipeline as model supports it.

Describe the solution you'd like.

fromcontrolnet_auximportOpenposeDetector, MidasDetectorfromdiffusers.utilsimportload_video, export_to_video, load_imageimporttorchfromdiffusersimportAutoencoderKLWan, WanVACEPipelinefromdiffusers.schedulers.scheduling_unipc_multistepimportUniPCMultistepScheduler# Free video downloaded from Pexelsvideo=load_video("https://huggingface.co/datasets/newgenai79/testing/resolve/main/2795750-hd_832_480_25fps.mp4?download=true")
video= [frame.convert("RGB").resize((832, 480)) forframeinvideo]
ref_image=load_image("https://huggingface.co/datasets/newgenai79/testing/resolve/main/00766-4015437123.png?download=true")
open_pose=OpenposeDetector.from_pretrained("lllyasviel/Annotators")
open_pose.to("cuda")
openpose_video= [open_pose(frame) forframeinvideo]
export_to_video(openpose_video, "openpose-man-contemporary-dance.mp4", fps=25)
delopen_pose, openpose_videodepth_midas=MidasDetector.from_pretrained("lllyasviel/Annotators")
depth_midas.to("cuda")
depth_video= [depth_midas(frame) forframeinvideo]
export_to_video(depth_video, "depth-man-contemporary-dance.mp4", fps=25)
deldepth_midas, video, depth_videomodel_id="a-r-r-o-w/Wan-VACE-1.3B-diffusers"vae=AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe=WanVACEPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
flow_shift=3.0# 5.0 for 720P, 3.0 for 480Ppipe.scheduler=UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
pipe.to("cuda")
prompt="An alien-like creature with a resemblance of leaves, branches and twigs is dancing gracefully in a post-apocalyptic world. The creature has a humanoid shape, with long, flowing limbs that resemble branches. Its skin is textured like bark, and its eyes glow softly. The background is a desolate landscape with remnants of a once-thriving city, now overgrown with vegetation. The lighting is soft and ethereal, casting a magical glow on the scene. The camera captures the creature from a low angle, emphasizing its height and gracefulness as it moves fluidly through the air."negative_prompt="Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"height=480width=832num_frames=50open_pose_video=load_video("openpose-man-contemporary-dance.mp4")[:num_frames]
open_pose_video= [frame.convert("RGB").resize((width, height)) forframeinopen_pose_video]
depth_video=load_video("depth-man-contemporary-dance.mp4")[:num_frames]
depth_video= [frame.convert("RGB").resize((width, height)) forframeindepth_video]
"""In this scenario either prompt or image without prompt.."""output=pipe(
video=[open_pose_video, depth_video],
prompt=prompt,
# and / orimage=ref_image,
negative_prompt=negative_prompt,
height=height,
width=width,
num_frames=num_frames,
num_inference_steps=30,
guidance_scale=5.0,
generator=torch.Generator().manual_seed(42),
).frames[0]
export_to_video(output, "output.mp4", fps=16)

Describe alternatives you've considered.
This is supported in Comfy (as shown in video) and I got the idea when it was requested here
deepbeepmeep/Wan2GP#266

Additional context.
Discussion

@a-r-r-o-w@DN6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions