Skip to content

Added Support for WAN Image Generation#974

Merged
ParamThakkar123 merged 42 commits intomainfrom
add/video-gen
Feb 19, 2026
Merged

Added Support for WAN Image Generation#974
ParamThakkar123 merged 42 commits intomainfrom
add/video-gen

Conversation

@ParamThakkar123
Copy link
Copy Markdown
Contributor

@ParamThakkar123 ParamThakkar123 commented Nov 29, 2025

Summary by CodeRabbit

  • New Features

    • Added support for video-style diffusion generation
    • Extended support for additional diffusion model architectures
  • Bug Fixes & Improvements

    • Enhanced image retrieval with improved file handling and validation
  • Chores

    • Updated plugin version to 0.1.0
    • Added dependency support

@ParamThakkar123 ParamThakkar123 marked this pull request as draft November 29, 2025 05:34
@ParamThakkar123
Copy link
Copy Markdown
Contributor Author

I added support for video generation models starting with Wan2.1 models will later extend to more models if this works, currently I added support for WanPipeline in supported model architectures in Image_diffusion plugin but it gives an error where its trying to find /workspace/jobs/None which doesn't exist

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 29, 2025

Codecov Report

❌ Patch coverage is 2.15054% with 182 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/transformerlab/plugins/image_diffusion/main.py 0.00% 153 Missing ⚠️
api/transformerlab/routers/experiment/diffusion.py 12.12% 27 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@deep1401
Copy link
Copy Markdown
Member

deep1401 commented Dec 2, 2025

I added support for video generation models starting with Wan2.1 models will later extend to more models if this works, currently I added support for WanPipeline in supported model architectures in Image_diffusion plugin but it gives an error where its trying to find /workspace/jobs/None which doesn't exist

There was an issue with running diffusion models, could you update and check if that issue is resolved now? The issue was caused by our new system with the workspace under orgs

@deep1401
Copy link
Copy Markdown
Member

deep1401 commented Dec 3, 2025

I added support for video generation models starting with Wan2.1 models will later extend to more models if this works, currently I added support for WanPipeline in supported model architectures in Image_diffusion plugin but it gives an error where its trying to find /workspace/jobs/None which doesn't exist

There was an issue with running diffusion models, could you update and check if that issue is resolved now? The issue was caused by our new system with the workspace under orgs

I figure this is still a WIP but I would also suggest not adding things to the existing image_diffusion plugin and creating a new video diffusion plugin.

@ParamThakkar123 ParamThakkar123 marked this pull request as ready for review December 5, 2025 18:19
Copy link
Copy Markdown
Member

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, we might have to restructure the PR and break it down into 2 and test these

Copy link
Copy Markdown
Member

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot to add this earlier but lets use this as a reference model for Wan support. This feels small enough to run on our hardware and diffusers required version is 0.33.0.dev so just updating to current diffusers prod version should work
https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B-Diffusers

@deep1401 deep1401 marked this pull request as draft December 5, 2025 20:17
@ParamThakkar123 ParamThakkar123 changed the title Added Video Generation support Added Video Generation support for generating images Dec 17, 2025
@ParamThakkar123 ParamThakkar123 marked this pull request as ready for review December 17, 2025 10:15
@deep1401 deep1401 changed the title Added Video Generation support for generating images Added Support for WAN Image Generation Feb 3, 2026
Copy link
Copy Markdown
Member

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I tested this and it works for me. There was a small bug which I pushed and fixed

But I just have some comments on changes made in the plugin, please let me know if you think they're not apt!

After test:

Image


def is_zimage_model(model: str) -> bool:
"""Return True if the model architecture is ZImagePipeline."""
def is_diffusion_pipeline_model(model: str) -> bool:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check this? Isnt this done by the router itself?

name = (model or "").lower()
return "z-image" in name or "zimage" in name
for arch in architectures:
if arch in DIFFUSION_PIPELINE_MODELS:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this just be based on a dictionary which determines pipeline based on the model_architecture param or something?

Copy link
Copy Markdown
Member

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing state of my previous review

Copy link
Copy Markdown
Member

@dadmobile dadmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff error:

Error: api/transformerlab/plugins/image_diffusion/main.py:1166:32: F821 Undefined name run_video_diffusion_genration

@ParamThakkar123
Copy link
Copy Markdown
Contributor Author

it was a typo 😅

Copy link
Copy Markdown
Member

@dadmobile dadmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Need to update plugin version
  2. I can't get this to run on azure. Any ideas?
Error during image generation: AutoPipeline can't find a pipeline linked to WanPipeline for wan
Error in Async Job: 500: Image generation failed: AutoPipeline can't find a pipeline linked to WanPipeline for wan
Traceback (most recent call last):
  File "/home/azureuser/.transformerlab/orgs/3c33c85b-628a-4ca8-93d3-b657cb7973b2/workspace/plugins/image_diffusion/main.py", line 1009, in diffusion_generate_job
    pipe = get_pipeline(
           ^^^^^^^^^^^^^
  File "/home/azureuser/.transformerlab/orgs/3c33c85b-628a-4ca8-93d3-b657cb7973b2/workspace/plugins/image_diffusion/main.py", line 411, in get_pipeline
    pipe = AutoPipelineForText2Image.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/.transformerlab/orgs/3c33c85b-628a-4ca8-93d3-b657cb7973b2/workspace/plugins/image_diffusion/venv/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/.transformerlab/orgs/3c33c85b-628a-4ca8-93d3-b657cb7973b2/workspace/plugins/image_diffusion/venv/lib/python3.11/site-packages/diffusers/pipelines/auto_pipeline.py", line 482, in from_pretrained
    text_2_image_cls = _get_task_class(AUTO_TEXT2IMAGE_PIPELINES_MAPPING, orig_class_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/.transformerlab/orgs/3c33c85b-628a-4ca8-93d3-b657cb7973b2/workspace/plugins/image_diffusion/venv/lib/python3.11/site-packages/diffusers/pipelines/auto_pipeline.py", line 311, in _get_task_class
    raise ValueError(f"AutoPipeline can't find a pipeline linked to {pipeline_class_name} for {model_name}")
ValueError: AutoPipeline can't find a pipeline linked to WanPipeline for wan

During handling of the above exception, another exception occurred:

Copy link
Copy Markdown
Member

@dadmobile dadmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped version to get it to reinstall and now it works!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 19, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces video diffusion support to the image diffusion plugin, adds WanPipeline architecture support throughout the system, enhances image retrieval with robust multi-file handling, and bumps the plugin version. Setup script adds ftfy dependency installation.

Changes

Cohort / File(s) Summary
Plugin Manifest
api/transformerlab/plugins/image_diffusion/index.json
Version bumped from 0.0.9 to 0.1.0.
Core Video Diffusion Logic
api/transformerlab/plugins/image_diffusion/main.py
Introduced DIFFUSION_PIPELINE_MODELS constant and is_diffusion_pipeline_model function to detect diffusion architectures. Enhanced get_pipeline with architecture detection and DiffusionPipeline loading. Added new async run_video_diffusion_generation_for_images for video-style frame generation with directory setup, device selection, and PNG sequencing. Integrated video diffusion routing into main workflow with error handling and output metadata adjustments.
Setup Configuration
api/transformerlab/plugins/image_diffusion/setup.sh
Added "uv pip install ftfy" command before existing pip install steps.
Router Enhancements
api/transformerlab/routers/experiment/diffusion.py
Expanded ALLOWED_TEXT2IMG_ARCHITECTURES and ALLOWED_IMG2IMG_ARCHITECTURES to include WanPipeline and DiffusionPipeline. Enhanced get_image_by_id with robust image file discovery and selection logic, directory listing fallbacks, image filename sorting, containment checks for path traversal prevention, and improved error messages. Maintains backward compatibility with old single-image format.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Main as main.py<br/>(diffusion plugin)
    participant Loader as Pipeline<br/>Loader
    participant VideoGen as run_video_<br/>diffusion_...
    participant Storage as File<br/>Storage

    Client->>Main: DiffusionRequest (video-style model)
    Main->>Main: is_diffusion_pipeline_model()
    alt Detected as Video Pipeline
        Main->>Loader: get_pipeline(model, controlnet_id, ...)
        Loader->>Loader: Detect DIFFUSION_PIPELINE_MODELS<br/>architecture
        Loader->>Main: Return DiffusionPipeline
        Main->>VideoGen: run_video_diffusion_generation_for_images()
        VideoGen->>VideoGen: Setup output directory<br/>Select device
        VideoGen->>Loader: Load pipeline with dtype
        VideoGen->>VideoGen: Extract & generate frames
        VideoGen->>Storage: Save frames as<br/>sequential PNGs
        VideoGen->>Main: Return image_paths, metadata
        Main->>Client: Return generation result<br/>(bypass multi-GPU path)
    else Standard Pipeline
        Main->>Main: Use existing loaders<br/>and multi-GPU path
        Main->>Client: Return generation result
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰✨ A rabbit hops through diffusion dreams,
With video frames and WanPipeline streams!
From single files to folders bright,
New pathways glow with generative light!
Version bumped, safety's sealed with care,
Video magic dances through the air! 🎬🌈

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add/video-gen

Comment @coderabbitai help to get the list of available commands and usage tips.

@ParamThakkar123 ParamThakkar123 merged commit 96d8758 into main Feb 19, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants