[TRTLLM-13028][doc] Add VisualGen API walkthrough example and docs page#14685
Conversation
Add examples/visual_gen/api_walkthrough.py — a slim, LLM-API-style walkthrough of the public VisualGen API on Wan 2.1 T2V that covers, in order: - VisualGen.supported_models() to list registered pipelines - VisualGen.pipeline_config(model) for per-architecture knobs - VisualGenArgs(pipeline_config=..., compilation_config=...) with the post-load warmup skipped - visual_gen.extra_param_specs to introspect model-specific extra_params keys - visual_gen.default_params with a num_frames override (and the matching extra_params override loop, no-op on Wan 2.1) - VisualGenOutput.save to persist the .avi to disk Add a "VisualGen Examples" section to the rendered TRT-LLM docs that mirrors the LLM Examples page, generated from examples/visual_gen/*.py at Sphinx build time via docs/source/helper.py. The new index sits between LLM Examples and Online Serving Examples in the Deployment Guide toctree. Register test_visual_gen_api_walkthrough in the same L0 lists that already exercise test_visual_gen_quickstart (l0_l40s.yml, l0_gh200.yml, l0_h100.yml, l0_dgx_b200.yml). Signed-off-by: Zhenhua Wang <zhenhuaw@nvidia.com>
|
/bot run |
📝 WalkthroughWalkthroughThis PR adds a VisualGen API example script with full documentation and integration testing. The changes update documentation generation to produce VisualGen example docs, integrate them into the main index, implement the example walkthrough, add an integration test to validate it, and register the test across multiple GPU test matrices. ChangesVisualGen API Walkthrough Example
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/integration/defs/examples/test_visual_gen.py (1)
1177-1197: Coverage is sufficient for this new example path.
tests/integration/defs/examples/test_visual_gen.py::test_visual_gen_api_walkthroughvalidates execution + output artifact, and the PR also wires it intotests/integration/test_lists/test-db/l0_dgx_b200.yml,tests/integration/test_lists/test-db/l0_gh200.yml,tests/integration/test_lists/test-db/l0_h100.yml, andtests/integration/test_lists/test-db/l0_l40s.yml.🤖 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 `@tests/integration/defs/examples/test_visual_gen.py` around lines 1177 - 1197, The test test_visual_gen_api_walkthrough manipulates model_dst by creating directories and a symlink but doesn't guard against an existing non-symlink destination nor perform cleanup, which can cause flaky runs; update the test to (1) if model_dst exists and is not a symlink, fail or skip with a clear message, (2) create the parent dirs and symlink only when model_dst is absent, and (3) remove the created symlink (and any empty parent dir you created) in a finally/teardown block after venv_check_call finishes; reference model_src, model_dst, venv_check_call and output_path when making these changes.
🤖 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/api_walkthrough.py`:
- Line 7: The function main is missing an explicit return type annotation;
update the definition of main in api_walkthrough.py to include a return type
(e.g., def main() -> None:) since this module requires all functions be
annotated — ensure the signature uses -> None if it does not return a value and
adjust any callers if you change the contract.
- Around line 1-4: This new module is missing the required NVIDIA SPDX
copyright/license header; add the standard NVIDIA SPDX header block at the very
top of the file before any metadata or imports so the file begins with the
license text followed by the existing lines that import VisualGen,
VisualGenArgs, and CompilationConfig; ensure the exact company and SPDX
identifier used across the repo is used verbatim and that the header precedes
the "### :title" metadata and the imports.
---
Nitpick comments:
In `@tests/integration/defs/examples/test_visual_gen.py`:
- Around line 1177-1197: The test test_visual_gen_api_walkthrough manipulates
model_dst by creating directories and a symlink but doesn't guard against an
existing non-symlink destination nor perform cleanup, which can cause flaky
runs; update the test to (1) if model_dst exists and is not a symlink, fail or
skip with a clear message, (2) create the parent dirs and symlink only when
model_dst is absent, and (3) remove the created symlink (and any empty parent
dir you created) in a finally/teardown block after venv_check_call finishes;
reference model_src, model_dst, venv_check_call and output_path when making
these changes.
🪄 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: 8e95a48d-d9e2-4388-a0e8-d8bb32cb22de
📒 Files selected for processing (8)
docs/source/helper.pydocs/source/index.rstexamples/visual_gen/api_walkthrough.pytests/integration/defs/examples/test_visual_gen.pytests/integration/test_lists/test-db/l0_dgx_b200.ymltests/integration/test_lists/test-db/l0_gh200.ymltests/integration/test_lists/test-db/l0_h100.ymltests/integration/test_lists/test-db/l0_l40s.yml
|
PR_Github #50757 [ run ] triggered by Bot. Commit: |
|
PR_Github #50757 [ run ] completed with state
|
|
/bot run |
|
PR_Github #50788 [ run ] triggered by Bot. Commit: |
|
PR_Github #50788 [ run ] completed with state
|
|
/bot run |
|
PR_Github #50924 [ run ] triggered by Bot. Commit: |
|
PR_Github #50924 [ run ] completed with state
|
|
/bot run |
|
PR_Github #51027 [ run ] triggered by Bot. Commit: |
|
PR_Github #51027 [ run ] completed with state |
Description
Adds a slim, LLM-API-style end-to-end walkthrough of the public VisualGen Python API as
examples/visual_gen/api_walkthrough.py, and wires up a "VisualGen Examples" page in the rendered docs that mirrors the LLM Examples page. The example walks throughVisualGen.supported_models(),VisualGen.pipeline_config(model),VisualGenArgs(pipeline_config=..., compilation_config=...)with warmup skipped,visual_gen.extra_param_specs,visual_gen.default_paramswith anum_framesoverride (plus the matchingextra_paramsoverride loop — no-op on Wan 2.1, real on Wan 2.2 A14B), andVisualGenOutput.save.The docs piece scans
examples/visual_gen/*.pyat Sphinx build time throughdocs/source/helper.py(same generator that builds the LLM API and trtllm-serve examples pages), producesdocs/source/examples/visual_gen_examples.rst, and mounts it betweenexamples/llm_api_examples.rstandexamples/trtllm_serve_examplesin the Deployment Guide toctree. Existingvisual_gen_*.py/.shCLI scripts without### :titlemetadata are temporarily added tohelper.py'signore_list; they can opt in later by adding the metadata block.The doc structure and the rendered version: https://sc.talos.nvidia.com/view/home/scratch.zhenhuaw_sw/llm/aigv/docs/build/html/index.html
Test Coverage
test_visual_gen_api_walkthroughregistered in the same L0 lists that already exercisetest_visual_gen_quickstart:l0_l40s.yml,l0_gh200.yml,l0_h100.yml,l0_dgx_b200.yml.make htmlbuilds clean with no new warnings onapi_walkthrough.rst/visual_gen_examples.rst; the "VisualGen Examples" entry shows up between LLM Examples and Online Serving Examples in the side nav.PR Checklist
Please review the following before submitting your PR:
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.Summary by CodeRabbit
New Features
Documentation
Tests