Skip to content

[TRTLLM-11318][feat] move VisualGen APIs to a separate dir#12538

Merged
zhenhuaw-me merged 1 commit into
NVIDIA:mainfrom
zhenhuaw-me:move-visualgen-apis
Apr 3, 2026
Merged

[TRTLLM-11318][feat] move VisualGen APIs to a separate dir#12538
zhenhuaw-me merged 1 commit into
NVIDIA:mainfrom
zhenhuaw-me:move-visualgen-apis

Conversation

@zhenhuaw-me
Copy link
Copy Markdown
Member

@zhenhuaw-me zhenhuaw-me commented Mar 25, 2026

Summary by CodeRabbit

  • Refactor

    • Visual Generation API has been reorganized into a dedicated module at tensorrt_llm.visual_gen. Users importing from the top-level tensorrt_llm package are unaffected.
  • Chores

    • Added license headers and updated code ownership assignments.

Description

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)

  • 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.

@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

This pull request relocates the VisualGen and VisualGenParams classes from tensorrt_llm/llmapi/visual_gen to a new standalone tensorrt_llm/visual_gen package. All import statements throughout the codebase, top-level exports, documentation, and configuration have been updated to reflect the new module location.

Changes

Cohort / File(s) Summary
Module Exports
tensorrt_llm/__init__.py, tensorrt_llm/llmapi/__init__.py, tensorrt_llm/visual_gen/__init__.py
Removed VisualGen and VisualGenParams exports from llmapi; added new visual_gen/__init__.py to expose these classes and MediaOutput from the new package location; updated top-level tensorrt_llm exports to import from visual_gen instead of llmapi.
Import Updates
tensorrt_llm/bench/benchmark/visual_gen.py, tensorrt_llm/serve/openai_server.py, tensorrt_llm/serve/visual_gen_utils.py, tests/unittest/_torch/visual_gen/test_visual_gen_args.py
Updated imports to reference VisualGen and VisualGenParams from tensorrt_llm.visual_gen instead of tensorrt_llm.llmapi.visual_gen.
Configuration & Documentation
.github/CODEOWNERS, docs/source/models/visual-generation.md, tensorrt_llm/visual_gen/visual_gen.py
Added CODEOWNERS entry assigning /tensorrt_llm/visual_gen to the LLM API development team; updated documentation to reflect new module path; added Apache-2.0 license header to visual_gen.py.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description is incomplete—it contains only the template with empty placeholder sections and no actual implementation details, rationale, or test coverage information. Fill in the Description section explaining why VisualGen APIs were moved and the benefits. Provide specific test coverage details and verify all checklist items are addressed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: moving VisualGen APIs to a separate directory, matching the actual refactoring across multiple files.

✏️ 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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tensorrt_llm/__init__.py`:
- Line 136: The file header year was not updated when this file was modified;
open the module that exports VisualGen and VisualGenParams (the top of
tensorrt_llm/__init__.py where VisualGen, VisualGenParams are imported) and
update the copyright header year range (replace 2024 with the current year) to
reflect the modification year.

In `@tensorrt_llm/serve/openai_server.py`:
- Line 40: Replace direct class/function imports with module-level imports and
update all usages to reference the module namespace: change "from
tensorrt_llm.llmapi import MultimodalEncoder, tracing" to "import
tensorrt_llm.llmapi as llmapi" and update references to llmapi.MultimodalEncoder
and llmapi.tracing.extract_trace_headers(...); similarly import the visual_gen
module (e.g., "import tensorrt_llm.visual_gen as visual_gen") and replace
VisualGen and VisualGenParams usages with visual_gen.VisualGen and
visual_gen.VisualGenParams so all symbols are accessed through their module
namespaces.

In `@tensorrt_llm/serve/visual_gen_utils.py`:
- Line 12: This file (tensorrt_llm/serve/visual_gen_utils.py) is missing the
required NVIDIA Apache/SPDX header; add the standard NVIDIA Apache 2.0 header
block (including SPDX-License-Identifier: Apache-2.0 and the copyright notice
with the year of the latest meaningful modification) at the top of the file
above the existing imports (e.g., above the line importing VisualGenParams),
ensuring the header format matches other TensorRT-LLM source files.

In `@tensorrt_llm/visual_gen/__init__.py`:
- Line 17: The __all__ export list in __init__.py is not sorted in isort-style
order; update the module-level __all__ to an alphabetically sorted list of the
exported names (VisualGen, VisualGenParams, MediaOutput) so it satisfies Ruff
RUF022 — locate the __all__ declaration in tensorrt_llm.visual_gen.__init__ and
reorder the entries into isort-style alphabetical order.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f025dcb3-6d47-4ad3-850f-cd14ee11a2f6

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5c434 and 28bbad5.

📒 Files selected for processing (10)
  • .github/CODEOWNERS
  • docs/source/models/visual-generation.md
  • tensorrt_llm/__init__.py
  • tensorrt_llm/bench/benchmark/visual_gen.py
  • tensorrt_llm/llmapi/__init__.py
  • tensorrt_llm/serve/openai_server.py
  • tensorrt_llm/serve/visual_gen_utils.py
  • tensorrt_llm/visual_gen/__init__.py
  • tensorrt_llm/visual_gen/visual_gen.py
  • tests/unittest/_torch/visual_gen/test_visual_gen_args.py
💤 Files with no reviewable changes (1)
  • tensorrt_llm/llmapi/init.py

Comment thread tensorrt_llm/__init__.py
Comment thread tensorrt_llm/serve/openai_server.py
Comment thread tensorrt_llm/serve/visual_gen_utils.py
Comment thread tensorrt_llm/visual_gen/__init__.py
@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40319 [ run ] triggered by Bot. Commit: 28bbad5 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40319 [ run ] completed with state SUCCESS. Commit: 28bbad5
/LLM/main/L0_MergeRequest_PR pipeline #31429 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

Link to invocation

Copy link
Copy Markdown
Collaborator

@QiJune QiJune left a comment

Choose a reason for hiding this comment

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

LGTM

@zhenhuaw-me zhenhuaw-me force-pushed the move-visualgen-apis branch from 28bbad5 to 214c517 Compare March 31, 2026 13:51
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40948 [ run ] triggered by Bot. Commit: 214c517 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40948 [ run ] completed with state FAILURE. Commit: 214c517
/LLM/main/L0_MergeRequest_PR pipeline #31936 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

Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41043 [ run ] completed with state FAILURE. Commit: fe79590
/LLM/main/L0_MergeRequest_PR pipeline #32022 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

Link to invocation

@zhenhuaw-me zhenhuaw-me force-pushed the move-visualgen-apis branch from fe79590 to 7c75288 Compare April 1, 2026 02:27
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41078 [ run ] triggered by Bot. Commit: 7c75288 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41078 [ run ] completed with state FAILURE. Commit: 7c75288
/LLM/main/L0_MergeRequest_PR pipeline #32054 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

Link to invocation

@zhenhuaw-me zhenhuaw-me enabled auto-merge (squash) April 1, 2026 06:16
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41129 [ run ] triggered by Bot. Commit: d10520b Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41129 [ run ] completed with state SUCCESS. Commit: d10520b
/LLM/main/L0_MergeRequest_PR pipeline #32100 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

Link to invocation

@zhenhuaw-me zhenhuaw-me force-pushed the move-visualgen-apis branch from d10520b to 21f6e38 Compare April 2, 2026 02:50
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41315 [ run ] triggered by Bot. Commit: 21f6e38 Link to invocation

@zhenhuaw-me zhenhuaw-me force-pushed the move-visualgen-apis branch from 21f6e38 to dd55c23 Compare April 2, 2026 10:13
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41416 [ run ] triggered by Bot. Commit: dd55c23 Link to invocation

@zhenhuaw-me zhenhuaw-me force-pushed the move-visualgen-apis branch from dd55c23 to 5b0f192 Compare April 2, 2026 15:41
@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41456 [ run ] triggered by Bot. Commit: 5b0f192 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41456 [ run ] completed with state SUCCESS. Commit: 5b0f192
/LLM/main/L0_MergeRequest_PR pipeline #32387 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

Link to invocation

@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41537 [ run ] triggered by Bot. Commit: 5b0f192 Link to invocation

@zhenhuaw-me
Copy link
Copy Markdown
Member Author

/bot skip --comment "Failing autodeploy DS and TensorRT backend test is unrelated to this PRs changes"

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41540 [ skip ] triggered by Bot. Commit: 5b0f192 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41540 [ skip ] completed with state SUCCESS. Commit: 5b0f192
Skipping testing for commit 5b0f192

Link to invocation

@zhenhuaw-me zhenhuaw-me merged commit 31fbf0f into NVIDIA:main Apr 3, 2026
5 checks passed
@zhenhuaw-me zhenhuaw-me deleted the move-visualgen-apis branch April 3, 2026 01:54
govind-ramnarayan pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Apr 6, 2026
karen-sy pushed a commit to karen-sy/TensorRT-LLM that referenced this pull request Apr 7, 2026
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.

5 participants