Skip to content

Add WanImage2ImagePipeline #12368

Open

Description

@vladmandic

Wan-AI/Wan2.2-T2V-A14B supported via WanPipeline is not only one of the best video models, its also widely popular as text-to-image model
(basically using it to produce video with single frame) due to its very good photo-realistic output.

Ask is to extend support by adding WanImage2ImagePipeline to allow image-to-image workflows
Work should be limited to setting timesteps and modifying prepare_latents method to take input image and strength params to encode input image and add noise to it, same as in pretty much any other image-to-image pipeline.

Note: this request is different than input image support in WanImageToVideoPipeline and WanVACEPipeline since

  • a) those pipelines work with different model weights, so user cannot switch from text-to-image to image-to-image without full model reload
  • b) they do not support denoising strength, image is taken as-is and if used in image-to-image workflow it will produce output identical to input.

Bonus: Also create WanInpaintPipeline to allow for image/mask combinations as input.

cc @yiyixuxu @sayakpaul @a-r-r-o-w @DN6

Activity

  1. added theissue type on Sep 29, 2025
  2. github-actions commented on Jan 9, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

    Please note that issues that do not follow the contributing guidelines are likely to be ignored.

  3. removed
    staleIssues that haven't received updates
    on Jan 9, 2026
  4. devanshi00 commented on Jan 30, 2026

    @devanshi00

    Hello I m interested in contributing to this issue.
    To do this, I plan to add a WanImage2ImagePipeline that closely mirrors standard diffusion image-to-image workflows while making only minimal, targeted changes:

    Reuse the existing WanPipeline architecture and weights

    The new pipeline will share the same tokenizer, text encoder, VAE, transformer(s), and scheduler as WanPipeline. This ensures users can switch seamlessly between text-to-image and image-to-image workflows without reloading or swapping model checkpoints.

    Introduce denoising-strength–based timestep control

    Image-to-image behavior will be enabled by computing the starting timestep from a user-provided strength parameter and running the denoising process only over the remaining timesteps. This follows the behavior of established img2img pipelines in diffusers and allows controlled deviation from the input image.

    Extend prepare_latents to support image initialization

    When an input image is provided:

    • The image will be encoded into latent space using the existing VAE
    • Noise will be added to the encoded latents at the selected starting timestep
    • These noisy latents will be used as the initial state for denoising

    If no image is provided, the pipeline will fall back to the existing random latent initialization, preserving current text-to-image behavior.

    Single-frame output

    Image-to-image generation will operate with num_frames = 1, leveraging Wan’s strong photo-realistic capabilities while remaining consistent with current single-frame text-to-image usage patterns.

    If this plan is okay then I will proceed further with the pr.

  5. devanshi00 commented on Feb 18, 2026

    @devanshi00

    Hello I m not sure but I m not getting the correct output for Wan-AI/Wan2.2-T2V-A14B-Diffusers
    My Script

    # pip install ftfy
    import torch
    import numpy as np
    from diffusers import  WanPipeline
    from diffusers.utils import export_to_video, load_image
    pipeline = WanPipeline.from_pretrained(
        "Wan-AI/Wan2.1-T2V-14B-Diffusers",
        torch_dtype=torch.bfloat16
    )
    
    pipeline.to("cuda")
    
    prompt = """
    The camera rushes from far to near in a low-angle shot, 
    revealing a white ferret on a log. It plays, leaps into the water, and emerges, as the camera zooms in 
    for a close-up. Water splashes berry bushes nearby, while moss, snow, and leaves blanket the ground. 
    Birch trees and a light blue sky frame the scene, with ferns in the foreground. Side lighting casts dynamic 
    shadows and warm highlights. Medium composition, front view, low angle, with depth of field.
    """
    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
    """
    
    output = pipeline(
        prompt=prompt,
        negative_prompt=negative_prompt,
        num_frames=81,
        guidance_scale=5.0,
    ).frames[0]
    
    export_to_video(output, "output.mp4", fps=16)

    I get the log:

    Fetching 3 files: 100%|███████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 52428.80it/s]
    Download complete: : 0.00B [00:00, ?B/s]                                                                     | 0/3 [00:00<?, ?it/s]
    Loading weights: 100%|██████████████████████████████████████| 242/242 [00:00<00:00, 4765.67it/s, Materializing param=shared.weight]
    UMT5EncoderModel LOAD REPORT from: Wan-AI/Wan2.2-T2V-A14B-Diffusers
    Key                         | Status  |
    ----------------------------+---------+-
    encoder.embed_tokens.weight | MISSING |
    
    Notes:
    - MISSING     :those params were newly initialized because missing from the checkpoint. Consider training on your downstream task.
    /home/zeus/miniconda3/envs/cloudspace/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py:202: UserWarning: The `local_dir_use_symlinks` argument is deprecated and ignored in `hf_hub_download`. Downloading to a local directory does not use symlinks anymore.
      warnings.warn(
    Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
    Download complete: : 0.00B [00:00, ?B/s]                                                                     | 0/3 [00:00<?, ?it/s]
    Loading weights: 100%|██████████████████████████████████████| 242/242 [00:00<00:00, 4765.67it/s, Materializing param=shared.weight]
    UMT5EncoderModel LOAD REPORT from: Wan-AI/Wan2.2-T2V-A14B-Diffusers
    Key                         | Status  |
    ----------------------------+---------+-
    encoder.embed_tokens.weight | MISSING |
    
    Notes:
    - MISSING     :those params were newly initialized because missing from the checkpoint. Consider training on your downstream task.
    
    100%|██████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [08:08<00:00,  9.78s/it]
    It is recommended to use `export_to_video` with `imageio` and `imageio-ffmpeg` as a backend.
    These libraries are not present in your environment. Attempting to use legacy OpenCV backend to export video.
    Support for the OpenCV backend will be deprecated in a future Diffusers version
    

    The output is:

    output.mp4

    Can you please look into this? I m also attaching a community issue with same problem here. Without the Text to Video Model Running correctly I cannot run my Image2ImagePipeline code also
    @DN6 @yiyixuxu @vladmandic

  6. devanshi00 commented on Feb 20, 2026

    @devanshi00

    Hello any updates on this?
    @DN6 @yiyixuxu

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions