Skip to content

WanImageToVideoPipeline update to work with offloading #11162

Description

@vladmandic

Describe the bug

Currently WAN I2V fails with offloaded model since image_processor returns image tensors on cpu while image_encoder gets moved to gpu by accelerate hook according to execution_device.

This simple patch fixes it by setting device explicitly
in pipelines/wan/pipeline_wan_i2v.py:

defencode_image(
self,
image: PipelineImageInput,
device: Optional[torch.device] =None,
):
device=deviceorself._execution_deviceimage=self.image_processor(images=image, return_tensors="pt").to(device)
image_embeds=self.image_encoder(**image, output_hidden_states=True)
returnimage_embeds.hidden_states[-2]

Reproduction

N/A

Logs

System Info

diffusers==main

Who can help?

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

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

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions