Skip to content

[None][feat] Add Qwen image support - #13449

Merged
yibinl-nvidia merged 25 commits into
NVIDIA:mainfrom
pst2154:add-qwen-image-support
Jun 3, 2026
Merged

[None][feat] Add Qwen image support#13449
yibinl-nvidia merged 25 commits into
NVIDIA:mainfrom
pst2154:add-qwen-image-support

Conversation

@pst2154

@pst2154 pst2154 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds support for Qwen image workflows.

Validation

  • Validation was run before filing this PR.
  • Added Qwen-Image parity coverage against diffusers for transformer components.
  • Added registry smoke tests for Qwen-Image AutoPipeline detection.

Summary by CodeRabbit

  • New Features

    • Added support for Qwen-Image text-to-image generation model with full pipeline integration
    • Supports single and batch image generation with configurable parameters (image size, denoising steps, CFG guidance, negative prompts)
    • Added example with timing metrics and JSON output for batch inference
  • Documentation

    • Updated feature matrix and serving documentation to include Qwen-Image with parameter specifications and supported features
  • Tests

    • Added parity validation tests and registry integration tests for the new model

@pst2154
pst2154 requested review from a team as code owners April 24, 2026 20:13
@pst2154
pst2154 requested review from QiJune and Shixiaowei02 April 24, 2026 20:13
@svc-trtllm-gh-bot svc-trtllm-gh-bot added the Community want to contribute PRs initiated from Community label Apr 24, 2026
@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request adds support for the Qwen-Image text-to-image model to TensorRT-LLM's VisualGen stack, including a transformer implementation, pipeline integration, serving configuration, example scripts, registry updates, and comprehensive parity and registry tests.

Changes

Cohort / File(s) Summary
Documentation
docs/source/models/visual-generation.md, examples/visual_gen/README.md, examples/visual_gen/serve/README.md
Added Qwen-Image as a supported VisualGen model with feature matrix, command templates, common arguments table, and serving instructions. Includes footnotes on classifier-free guidance, quantization status, and native BF16 parity with diffusers.
Serving Configuration
examples/visual_gen/serve/configs/qwen_image.yml
New TensorRT-LLM runtime config for Qwen-Image specifying vanilla attention backend, parallel sizing, and warmup skipping via empty resolution/frame lists.
Example Script
examples/visual_gen/visual_gen_qwen_image.py
New CLI script for Qwen-Image text-to-image inference supporting single-prompt and batch modes, with image output saving and per-image timing metrics written to timing.json.
Module Exports
tensorrt_llm/_torch/visual_gen/models/__init__.py, tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py
Updated module exports to surface QwenImagePipeline and transformer components (normalization, embeddings, blocks, attention, rotary embeddings) from the new qwen_image package.
Pipeline Implementation
tensorrt_llm/_torch/visual_gen/models/qwen_image/pipeline_qwen_image.py
Registered QwenImagePipeline performing end-to-end text-to-image generation using Qwen2.5-VL for prompt encoding, custom transformer, AutoencoderKLQwenImage for VAE, and FlowMatchEulerDiscreteScheduler. Includes prompt/negative-prompt encoding, classifier-free guidance with true_cfg_scale, latent packing/unpacking, and denoising loop.
Transformer Implementation
tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py
New QwenImageTransformer2DModel (Phase 1) with timestep embeddings, 3D rotary positional encodings, RMSNorm/AdaLayerNorm, feed-forward blocks, joint attention, and transformer block stacking. Supports config-based construction, HuggingFace weight loading, and forward inference with optional diffusers output format.
Registry Update
tensorrt_llm/_torch/visual_gen/pipeline_registry.py
Extended AutoPipeline._detect_from_checkpoint to recognize QwenImage pipeline variants from model_index.json class names and route them to QwenImagePipeline.
Tests
tests/unittest/_torch/visual_gen/test_qwen_image_parity.py, tests/unittest/_torch/visual_gen/test_qwen_image_registry.py
Added parity validation tests comparing TensorRT-LLM transformer outputs to diffusers reference implementation across timestep embeddings, RoPE, blocks, and full forward passes; and registry tests verifying pipeline detection and instantiation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QwenImagePipeline
    participant Qwen25VL as Qwen2.5-VL<br/>(Prompt Encoder)
    participant Transformer as Qwen Image<br/>Transformer2DModel
    participant VAE as AutoencoderKL<br/>Qwen Image
    participant Scheduler as FlowMatch Euler<br/>Discrete Scheduler
    participant Output as Output<br/>MediaOutput

    User->>QwenImagePipeline: infer(prompt, negative_prompt, steps, cfg_scale)
    
    QwenImagePipeline->>Qwen25VL: encode(prompt)
    Qwen25VL-->>QwenImagePipeline: text_embeddings, text_mask
    
    alt Classifier-Free Guidance
        QwenImagePipeline->>Qwen25VL: encode(negative_prompt)
        Qwen25VL-->>QwenImagePipeline: uncond_embeddings, uncond_mask
    end
    
    QwenImagePipeline->>QwenImagePipeline: initialize_latents()
    
    loop for each timestep
        QwenImagePipeline->>Transformer: forward(latents, text_embeddings, timestep)
        Transformer-->>QwenImagePipeline: model_pred
        
        alt with CFG
            QwenImagePipeline->>Transformer: forward(latents, uncond_embeddings, timestep)
            Transformer-->>QwenImagePipeline: uncond_pred
            QwenImagePipeline->>QwenImagePipeline: apply_cfg(model_pred, uncond_pred, cfg_scale)
        end
        
        QwenImagePipeline->>Scheduler: step(pred, timestep, latents)
        Scheduler-->>QwenImagePipeline: updated_latents
    end
    
    QwenImagePipeline->>VAE: decode(latents)
    VAE-->>QwenImagePipeline: image (uint8)
    
    QwenImagePipeline->>Output: wrap image
    Output-->>User: MediaOutput(image)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. While it mentions 'adds support for Qwen image workflows' and lists validation efforts, it lacks the required 'Description' and 'Test Coverage' sections from the template, and the provided summary is brief without detailed explanation. Add a detailed 'Description' section explaining the changes (pipeline, transformer, registry, examples, docs) and a 'Test Coverage' section clearly listing all test files added/modified (test_qwen_image_parity.py, test_qwen_image_registry.py) with brief descriptions of what they validate.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title '[None][feat] Add Qwen image support' is related to the changeset, clearly indicating the addition of Qwen-Image functionality, which is the primary focus across all modified 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🧹 Nitpick comments (2)
tests/unittest/_torch/visual_gen/test_qwen_image_parity.py (2)

23-31: Avoid checking in a developer-local checkpoint default.

Baking /home/scratch.asteiner/... into the repo means everyone else silently skips this suite unless they override QWEN_IMAGE_CKPT. Prefer env-var-only discovery or a shared repo convention for model roots.

Proposed fix
-_DEFAULT_CKPT = "/home/scratch.asteiner/trtllm-qwen-image/models/qwen-image"
+_DEFAULT_CKPT = ""
 _CKPT_ENV = "QWEN_IMAGE_CKPT"
@@
 def _ckpt_path() -> Path | None:
-    path = Path(os.environ.get(_CKPT_ENV, _DEFAULT_CKPT))
+    ckpt = os.environ.get(_CKPT_ENV, _DEFAULT_CKPT)
+    if not ckpt:
+        return None
+    path = Path(ckpt)
     if not (path / "transformer" / "config.json").is_file():
         return None
     return path
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unittest/_torch/visual_gen/test_qwen_image_parity.py` around lines 23 -
31, Remove the developer-local hardcoded default in _DEFAULT_CKPT and make
_ckpt_path() rely only on the environment variable _CKPT_ENV (or return None
when unset/invalid); specifically, replace the current behavior where
_DEFAULT_CKPT points to "/home/scratch.asteiner/..." so that _ckpt_path() reads
os.environ.get(_CKPT_ENV) and validates that path (checking for
"transformer/config.json"), returning None if the env var is not set or the file
is missing; update references to _DEFAULT_CKPT to remove or deprecate it so
tests only run when QWEN_IMAGE_CKPT is explicitly provided.

411-466: Please verify Qwen-Image also lands in scheduled perf coverage.

This slow parity test is good correctness coverage, but it will not catch latency/throughput regressions unless the new model path was also added to the perf sanity definitions and the test-db / QA perf lists elsewhere in the PR.

As per coding guidelines "If the PR touches performance-sensitive paths ... check whether a perf test entry is present or updated in: (a) tests/integration/test_lists/test-db/l0_perf.yml ... and (b) tests/integration/test_lists/qa/llm_perf_*.yml ...".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unittest/_torch/visual_gen/test_qwen_image_parity.py` around lines 411
- 466, The PR added a slow parity test (test_qwen_image_transformer_full_parity
/ QwenImageTransformer2DModel) but did not add the new model path to scheduled
performance coverage; add entries for the Qwen-Image path to the perf test lists
so latency/throughput regressions are caught: update
tests/integration/test_lists/test-db/l0_perf.yml to include a perf entry
referencing test_qwen_image_transformer_full_parity or
QwenImageTransformer2DModel and also add corresponding entries in
tests/integration/test_lists/qa/llm_perf_*.yml (matching naming and tags used by
existing perf jobs), ensuring the test is included in the test-db and QA perf
suites and any required markers (e.g., slow or device requirements) are
preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/visual_gen/README.md`:
- Around line 279-303: The markdown table has mismatched column counts and a
misplaced footnote that breaks the table; update each argument row (e.g.,
`--model_path`, `--linear_type`, `--true_cfg_scale`, `--negative_prompt`) so
every row has seven pipe-separated cells to match the header, ensure empty
values are represented with a clear placeholder (e.g., "—") rather than dropping
a cell, and move the footnote definition `[^qi]` outside/after the table block
so it does not terminate the table prematurely.

In `@examples/visual_gen/visual_gen_qwen_image.py`:
- Around line 180-181: When load_prompts(args.prompts_file, args.num_prompts)
returns an empty list, subsequent batch processing divides by len(times) and
crashes; add a guard right after prompts = load_prompts(...) to detect if
prompts is empty and either raise a clear error (reject the file) or early-exit,
or ensure avg_time calculation is protected by checking len(times) > 0 before
dividing (e.g., set avg_time = 0 or skip averaging when times is empty). Update
the code paths that use prompts, times, and avg_time (references: load_prompts,
prompts, times, avg_time) so empty prompt files are handled safely and do not
cause a ZeroDivisionError.
- Around line 139-144: In load_prompts, strip each line before checking for
emptiness or comments so indented comment lines (e.g., "  # ...") are ignored;
change the comprehension to call line.strip() once into a variable and then
filter with that stripped value (refer to function load_prompts and the variable
prompts) so you test stripped_line and stripped_line.startswith("#") before
adding to prompts.

In `@tensorrt_llm/_torch/visual_gen/models/__init__.py`:
- Line 24: This module lacks the required NVIDIA source header; add the standard
NVIDIA copyright/header block at the top of
tensorrt_llm/_torch/visual_gen/models/__init__.py (the file that exports
QwenImagePipeline) and ensure the header reflects the current year for a
modified file; place the header before any imports and preserve existing license
formatting used across other Python files in the repo.

In `@tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py`:
- Around line 4-12: The module docstring in the Qwen-Image package still claims
the transformer is a stub raising NotImplementedError and references
PHASE1_PLAN.md and registry-only scaffolding; update it to accurately describe
the current implementation by removing the "stub" wording and
NotImplementedError claim, noting that the implemented transformer stack and
real pipeline are now re-exported (mentioning the pipeline and transformer stack
by name), and adjust or remove the AutoPipeline/phase-plan references so the
docstring reflects that the real pipeline and sidecars are loaded and
functional.

In `@tensorrt_llm/_torch/visual_gen/models/qwen_image/pipeline_qwen_image.py`:
- Around line 396-403: The negative prompt list is not being expanded to match
the fully expanded prompts batch, causing a CFG-size mismatch with latents in
infer(); fix by expanding/broadcasting negative prompts exactly the same way as
prompts are expanded: read negative_prompt into negatives (singleton or list),
then build negative = [n for n in negatives for _ in range(num_per)] but applied
across the expanded prompt list (i.e., use the same comprehension/replication
logic you used to turn req.prompt into prompts), ensuring the resulting negative
list length equals len(prompts) * num_per (or simply matches len(prompts) after
your expansion) so the CFG batch and latents sizes align in
pipeline_qwen_image.py (use the same variables num_per, prompts,
negative/negatives to locate and update the code).
- Around line 535-536: The log guard dereferences self.rank which may not exist
(BasePipeline sets self.mapping, not rank); change the check to safely handle
missing attribute, e.g. replace the `if self.rank == 0:` guard with `if
getattr(self, "rank", 0) == 0:` or an equivalent `hasattr(self, "rank") and
self.rank == 0` so logger.info("Pipeline total: ...") cannot raise
AttributeError; update the check near the logger.info call in
pipeline_qwen_image.py referencing self.rank/self.mapping/BasePipeline to locate
the change.

In `@tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py`:
- Around line 829-852: The method currently accepts optional timestep and
img_shapes but then uses them unconditionally (timestep.to(...) and
self.pos_embed(...)), which will raise obscure errors; either change the
signature to remove Optional for timestep and img_shapes or add explicit early
validation: check if timestep is None or img_shapes is None at the start of the
function (before timestep.to and self.pos_embed) and raise a clear ValueError
identifying the missing parameter(s). Reference the parameters timestep and
img_shapes and the calls self.time_text_embed(...) and self.pos_embed(... ) in
transformer_qwen_image.py when adding the guard or updating the type hints.
- Around line 51-60: The code uses an assert in get_timestep_embedding to
validate timesteps shape which can be stripped under python -O; replace the
assert with raising a ValueError with the same descriptive message (e.g.,
"Timesteps should be a 1d-array") so invalid inputs fail fast and consistently;
update the validation in get_timestep_embedding to raise ValueError when
len(timesteps.shape) != 1.

In `@tensorrt_llm/_torch/visual_gen/pipeline_registry.py`:
- Line 5: The file pipeline_registry.py is missing the required NVIDIA copyright
header; add the standard multi-line NVIDIA header block at the very top of the
module (before any imports or code) and update the copyright year to the current
year. Ensure the header appears in pipeline_registry.py and precedes the
existing decorator/registration code such as the `@register_pipeline` usages so
the file now complies with the /*** NVIDIA ... ***/ style header required by the
repository guidelines.

In `@tests/unittest/_torch/visual_gen/test_qwen_image_registry.py`:
- Line 95: The pytest.raises call uses a normal string for a regex pattern;
change the match argument to a raw string to make the regex explicit and
consistent with other tests (update the pytest.raises(...) call that currently
uses "Missing keys|Unexpected keys" to use r"Missing keys|Unexpected keys").
Ensure only the match string is modified to a raw string in the test function
located in test_qwen_image_registry.py.

---

Nitpick comments:
In `@tests/unittest/_torch/visual_gen/test_qwen_image_parity.py`:
- Around line 23-31: Remove the developer-local hardcoded default in
_DEFAULT_CKPT and make _ckpt_path() rely only on the environment variable
_CKPT_ENV (or return None when unset/invalid); specifically, replace the current
behavior where _DEFAULT_CKPT points to "/home/scratch.asteiner/..." so that
_ckpt_path() reads os.environ.get(_CKPT_ENV) and validates that path (checking
for "transformer/config.json"), returning None if the env var is not set or the
file is missing; update references to _DEFAULT_CKPT to remove or deprecate it so
tests only run when QWEN_IMAGE_CKPT is explicitly provided.
- Around line 411-466: The PR added a slow parity test
(test_qwen_image_transformer_full_parity / QwenImageTransformer2DModel) but did
not add the new model path to scheduled performance coverage; add entries for
the Qwen-Image path to the perf test lists so latency/throughput regressions are
caught: update tests/integration/test_lists/test-db/l0_perf.yml to include a
perf entry referencing test_qwen_image_transformer_full_parity or
QwenImageTransformer2DModel and also add corresponding entries in
tests/integration/test_lists/qa/llm_perf_*.yml (matching naming and tags used by
existing perf jobs), ensuring the test is included in the test-db and QA perf
suites and any required markers (e.g., slow or device requirements) are
preserved.
🪄 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: 05d6a6f4-29c7-4cb8-ac9f-d04e3352d236

📥 Commits

Reviewing files that changed from the base of the PR and between 55e2727 and aa2767e.

📒 Files selected for processing (12)
  • docs/source/models/visual-generation.md
  • examples/visual_gen/README.md
  • examples/visual_gen/serve/README.md
  • examples/visual_gen/serve/configs/qwen_image.yml
  • examples/visual_gen/visual_gen_qwen_image.py
  • tensorrt_llm/_torch/visual_gen/models/__init__.py
  • tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py
  • tensorrt_llm/_torch/visual_gen/models/qwen_image/pipeline_qwen_image.py
  • tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py
  • tensorrt_llm/_torch/visual_gen/pipeline_registry.py
  • tests/unittest/_torch/visual_gen/test_qwen_image_parity.py
  • tests/unittest/_torch/visual_gen/test_qwen_image_registry.py

Comment thread examples/visual_gen/README.md Outdated
Comment thread examples/visual_gen/visual_gen_qwen_image.py Outdated
Comment thread examples/visual_gen/visual_gen_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/__init__.py
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/pipeline_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/pipeline_registry.py
Comment thread tests/unittest/_torch/visual_gen/test_qwen_image_registry.py Outdated
@chang-l chang-l added VisualGen and removed Community want to contribute PRs initiated from Community labels Apr 24, 2026
@svc-trtllm-gh-bot svc-trtllm-gh-bot added the Community want to contribute PRs initiated from Community label Apr 24, 2026

@chang-l chang-l left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this PR also support Qwen-Image-2512 : https://huggingface.co/Qwen/Qwen-Image-2512?

Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/pipeline_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py Outdated

pst2154 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

Pushed f85525e783 with the review fixes.

Summary:

  • Addressed the CodeRabbit items: fixed the README table, prompt-file empty/comment handling, missing NVIDIA headers, negative prompt broadcasting, safe rank logging, explicit transformer argument validation, assert -> ValueError, raw regex string, and removed the developer-local checkpoint default.
  • Reworked the Qwen Image transformer to reuse TRT-LLM/VisualGen modules per the reviewer request.
  • Ran local checks:
    • python -m py_compile ...
    • git diff --check
  • Ran focused GPU validation inside nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc12 on alon-ts1-iec-05:
    • QWEN_IMAGE_CKPT=/models/qwen-image python3 -m pytest /tmp/qwen_tests/test_qwen_image_registry.py /tmp/qwen_tests/test_qwen_image_parity.py -q
    • Result: 22 passed.

On Qwen-Image-2512: its Hugging Face transformer/config.json uses the same QwenImageTransformer2DModel class and matching core transformer dimensions (attention_head_dim=128, axes_dims_rope=[16,56,56], in_channels=64, joint_attention_dim=3584, num_attention_heads=24, num_layers=60, out_channels=16, patch_size=2), so the implementation is expected to be compatible through the same Qwen Image path. I have validated this commit against Qwen/Qwen-Image; I have not yet run an end-to-end validation with a local Qwen/Qwen-Image-2512 checkpoint.

pst2154 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

Update on Qwen-Image-2512 validation: I downloaded Qwen/Qwen-Image-2512 to the GPU host and ran the same focused validation in nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc12.

Command shape:

QWEN_IMAGE_CKPT=/models/qwen-image-2512 python3 -m pytest /tmp/qwen_tests/test_qwen_image_registry.py /tmp/qwen_tests/test_qwen_image_parity.py -q

Result: 22 passed, 37 warnings in 273.51s.

So the transformer/registry parity path is now validated for both Qwen/Qwen-Image and Qwen/Qwen-Image-2512.

@chang-l chang-l left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dropped a few other comments and thanks for your patience!
Also adding @zhenhuaw-me to help review as well

Comment thread docs/source/models/visual-generation.md Outdated
Comment thread examples/visual_gen/serve/README.md Outdated
Comment thread examples/visual_gen/README.md Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/transformer_qwen_image.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/models/qwen_image/__init__.py
Comment thread tests/unittest/_torch/visual_gen/test_qwen_image_parity.py Outdated
@chang-l
chang-l requested a review from zhenhuaw-me April 29, 2026 23:39

pst2154 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 1744abfb18 with the latest review fixes.

Summary:

  • Aligned the Qwen-Image feature matrix / serve docs with FLUX.2-style VisualGen support and clarified dynamic FP8/NVFP4 from BF16 checkpoints.
  • Fixed the common-args text_encoder_path row.
  • Removed package-level FeedForward / RMSNorm exports and removed the custom Qwen RMSNorm class.
  • Switched per-head Q/K normalization to F.rms_norm(...) using the shared TRT-LLM RMSNorm weights.
  • Kept the masked attention branch and documented why Qwen needs it for padded text tokens.
  • Added TODO/commentary for future fused qk-norm+RoPE once Qwen's complex RoPE cache is adapted to the shared cos/sin format.
  • Added a CUDA tiny-transformer forward sanity test for both unmasked and text-masked paths.

Validation:

  • python -m py_compile ... passed.
  • git diff --check passed.
  • Targeted local pytest is still blocked by missing mpi4py in tests/unittest/conftest.py.
  • In the TRT-LLM 1.3.0rc12 release container, validated the modified Qwen source as an overlay on the container's built TensorRT-LLM package: syntax ok, Qwen module import ok, tiny transformer forward ok for both mask=False and mask=True.

@NVShreyas NVShreyas changed the title Add Qwen image support [None][feat] Add Qwen image support Apr 30, 2026
@yibinl-nvidia
yibinl-nvidia force-pushed the add-qwen-image-support branch 4 times, most recently from 413b6f9 to 66e8292 Compare May 22, 2026 03:53
@yibinl-nvidia yibinl-nvidia removed the Community want to contribute PRs initiated from Community label May 22, 2026
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49842 [ run ] triggered by Bot. Commit: 66e8292 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49842 [ run ] completed with state FAILURE. Commit: 66e8292
/LLM/main/L0_MergeRequest_PR pipeline #39426 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

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49846 [ run ] triggered by Bot. Commit: 66e8292 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49846 [ run ] completed with state FAILURE. Commit: 66e8292
/LLM/main/L0_MergeRequest_PR pipeline #39430 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

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51180 [ run ] completed with state SUCCESS. Commit: 26bffdf
/LLM/main/L0_MergeRequest_PR pipeline #40610 completed with status: 'SUCCESS'

CI Report

Link to invocation

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot reuse-pipeline

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51313 [ reuse-pipeline ] triggered by Bot. Commit: e405c4d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51313 [ reuse-pipeline ] completed with state SUCCESS. Commit: e405c4d
Reusing PR_Github #51180 for commit e405c4d

Link to invocation

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
Comment thread docs/source/models/visual-generation.md
Comment thread docs/source/models/visual-generation.md Outdated
Comment thread docs/source/models/visual-generation.md Outdated
Comment thread tests/unittest/_torch/visual_gen/test_qwen_image_registry.py Outdated
Comment thread tensorrt_llm/_torch/visual_gen/pipeline_registry.py
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51506 [ run ] triggered by Bot. Commit: 30af245 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51506 [ run ] completed with state SUCCESS. Commit: 30af245
/LLM/main/L0_MergeRequest_PR pipeline #40912 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

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51555 [ run ] triggered by Bot. Commit: 30af245 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51555 [ run ] completed with state SUCCESS. Commit: 30af245
/LLM/main/L0_MergeRequest_PR pipeline #40953 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

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51588 [ run ] triggered by Bot. Commit: 30af245 Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot kill

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51588 [ run ] completed with state SUCCESS. Commit: 30af245
/LLM/main/L0_MergeRequest_PR pipeline #40977 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

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51680 [ run ] triggered by Bot. Commit: 30af245 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51680 [ run ] completed with state SUCCESS. Commit: 30af245
/LLM/main/L0_MergeRequest_PR pipeline #41060 completed with status: 'SUCCESS'

CI Report

Link to invocation

@yibinl-nvidia
yibinl-nvidia merged commit 180eedb into NVIDIA:main Jun 3, 2026
7 checks passed
@yibinl-nvidia
yibinl-nvidia deleted the add-qwen-image-support branch June 3, 2026 21:10
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