Skip to content

[None][feat] add Wan I2V generation example#14981

Merged
chang-l merged 2 commits into
NVIDIA:mainfrom
o-stoner:user/o-stoner/visual-gen-update-wan-i2v-example
Jun 5, 2026
Merged

[None][feat] add Wan I2V generation example#14981
chang-l merged 2 commits into
NVIDIA:mainfrom
o-stoner:user/o-stoner/visual-gen-update-wan-i2v-example

Conversation

@o-stoner
Copy link
Copy Markdown
Collaborator

@o-stoner o-stoner commented Jun 5, 2026

Summary by CodeRabbit

  • New Features

    • Added image-to-video generation capability, enabling conversion of static images to video content.
  • Documentation

    • Updated usage examples and added configuration template for image-to-video workflows.

Description

Added the Wan I2V example back to ToT following the pattern introduced by wan_t2v.py.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

o-stoner added 2 commits June 4, 2026 17:40
Signed-off-by: Olivia Stoner <245287810+o-stoner@users.noreply.github.com>
Signed-off-by: Olivia Stoner <245287810+o-stoner@users.noreply.github.com>
@o-stoner o-stoner requested a review from a team as a code owner June 5, 2026 01:17
@o-stoner
Copy link
Copy Markdown
Collaborator Author

o-stoner commented Jun 5, 2026

/bot run --disable-fail-fast

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds image-to-video (I2V) capability to the VisualGen examples by introducing a new executable script (wan_i2v.py), a FP4-quantized configuration preset, and updated documentation showing how to run I2V generation.

Changes

VisualGen I2V Example

Layer / File(s) Summary
Documentation and configuration
examples/visual_gen/README.md, examples/visual_gen/configs/wan2.2-i2v-fp4-1gpu.yaml
README usage section updated to include I2V example commands alongside existing T2V examples; new Wan 2.2 I2V configuration preset specifies NVFP4 dynamic quantization, vanilla attention, minimal parallel settings, and disabled CUDA graphs for 1-GPU inference.
I2V example script implementation
examples/visual_gen/models/wan_i2v.py
New executable script with CLI argument parsing for model ID/path, optional YAML config, input image, and output MP4 path; loads VisualGenArgs from config, instantiates VisualGen, sets image parameter, generates video with fixed prompt, saves output, and prints completion status.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • NVIDIA/TensorRT-LLM#14632: Related migration replacing complex visual_gen_wan_i2v.py CLI wrapper with streamlined examples-based implementation.

Suggested labels

VisualGen

Suggested reviewers

  • venkywonka
  • karljang
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description provides a brief explanation of the change but lacks critical sections required by the template, including Test Coverage details, which is essential for code review. Complete the Test Coverage section to explain what tests safeguard these new changes, or clarify why no tests are needed for this example addition.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a Wan I2V generation example, following the established feature naming convention.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
examples/visual_gen/models/wan_i2v.py (1)

31-31: ⚡ Quick win

Add explicit return type annotation to main.

main should be annotated as returning None for typing/lint consistency.

Suggested patch
-def main():
+def main() -> None:

As per coding guidelines, "Always annotate functions; make the return type None if the function does not return anything."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/visual_gen/models/wan_i2v.py` at line 31, Add an explicit return
type annotation to the top-level function main by changing its signature to
declare it returns None (i.e., annotate main as returning None). Update the
definition of main() to def main() -> None: so it complies with the project's
typing/lint rules; no other logic changes required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/visual_gen/models/wan_i2v.py`:
- Around line 48-52: Add an early validation for the "--image" CLI argument
right after parsing (where parser.parse_args() is invoked) to fail fast if the
provided path is missing or not a file: use os.path.exists/os.path.isfile on
args.image and call parser.error(f"Image file not found: {args.image}") or
sys.exit with a clear message; apply the same pattern to the other CLI inputs in
this file (the second block around the 59-69 region) that accept file paths so
invalid paths are detected immediately (reference the "--image" argument,
args.image variable, parser.parse_args(), and the second file-path argument in
that section).

---

Nitpick comments:
In `@examples/visual_gen/models/wan_i2v.py`:
- Line 31: Add an explicit return type annotation to the top-level function main
by changing its signature to declare it returns None (i.e., annotate main as
returning None). Update the definition of main() to def main() -> None: so it
complies with the project's typing/lint rules; no other logic changes required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: aece5031-7fd9-4b72-815d-5663468da22e

📥 Commits

Reviewing files that changed from the base of the PR and between a50b5e2 and 96efc9d.

📒 Files selected for processing (3)
  • examples/visual_gen/README.md
  • examples/visual_gen/configs/wan2.2-i2v-fp4-1gpu.yaml
  • examples/visual_gen/models/wan_i2v.py

Comment thread examples/visual_gen/models/wan_i2v.py
@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #52197 [ run ] triggered by Bot. Commit: 96efc9d Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #52197 [ run ] completed with state FAILURE. Commit: 96efc9d
/LLM/main/L0_MergeRequest_PR pipeline #41517 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@o-stoner
Copy link
Copy Markdown
Collaborator Author

o-stoner commented Jun 5, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #52386 [ run ] triggered by Bot. Commit: 96efc9d Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #52386 [ run ] completed with state SUCCESS. Commit: 96efc9d
/LLM/main/L0_MergeRequest_PR pipeline #41682 completed with status: 'SUCCESS'

CI Report

Link to invocation

@chang-l chang-l merged commit 3e17560 into NVIDIA:main Jun 5, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants