Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/models/supported-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ For full documentation, see the [Visual Generation](./visual-generation.md) page
| `Lightricks/LTX-2` | Text-to-Video (with Audio), Image-to-Video (with Audio) |
| `Qwen/Qwen-Image` | Text-to-Image |
| `Qwen/Qwen-Image-2512` | Text-to-Image |
| `Qwen/Qwen-Image-Layered` | Image-to-Image |
| `nvidia/Cosmos3-Nano` | Text-to-Image, Text-to-Video, Image-to-Video |
| `nvidia/Cosmos3-Super` | Text-to-Image, Text-to-Video, Image-to-Video |

Expand All @@ -178,6 +179,8 @@ For full documentation, see the [Visual Generation](./visual-generation.md) page
| **Wan 2.2** | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| **LTX-2** | Yes | Yes | No | Yes | Yes | No | No | Yes | Yes | Yes | Yes | No |
| **Qwen-Image** [^2] | Yes | Yes | No | No | Yes | No | Yes | Yes | Yes | Yes | Yes | No |
| **Qwen-Image-Layered** [^3] | No | No | No | No | No | No | Yes | Yes | No | No | No | No |
| **Cosmos3** | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | No | No | Yes |

[^vg1]: FLUX models use embedded guidance and do not have a separate negative prompt path, so CFG parallelism is not applicable.
[^3]: Qwen-Image-Layered supports baseline BF16 image-conditioned layer decomposition. FP8 blockwise, NVFP4, `trtllm-serve` image-edit routing, and attention-parallel backends are not enabled yet.
4 changes: 4 additions & 0 deletions docs/source/models/visual-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ TensorRT-LLM **VisualGen** provides a unified inference stack for diffusion mode
| `Lightricks/LTX-2` | Text-to-Video (with Audio), Image-to-Video (with Audio) |
| `Qwen/Qwen-Image` | Text-to-Image |
| `Qwen/Qwen-Image-2512` | Text-to-Image |
| `Qwen/Qwen-Image-Layered` | Image-to-Image |
| `nvidia/Cosmos3-Nano` | Text-to-Image, Text-to-Video, Image-to-Video |
| `nvidia/Cosmos3-Super` | Text-to-Image, Text-to-Video, Image-to-Video |

Expand All @@ -53,6 +54,7 @@ Models are auto-detected from the checkpoint directory. Diffusers-format models
| **Wan 2.2** | Yes | Yes | Yes [^3] | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| **LTX-2** | Yes | Yes | Yes [^4] | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes | No | No |
| **Qwen-Image** [^5] | Yes | Yes | No | No | No | Yes | No | Yes | Yes | Yes | Yes | Yes | No | No |
| **Qwen-Image-Layered** [^6] | No | No | No | No | No | No | No | Yes | Yes | No | No | No | No | No |
Comment thread
yumin066 marked this conversation as resolved.
| **Cosmos3** | Yes | Yes | No | No | Yes | Yes | Yes | Yes | Yes | Yes | No | No | Yes | No |

[^1]: FLUX models use embedded guidance and do not have a separate negative prompt path, so CFG parallelism is not applicable.
Expand All @@ -65,6 +67,8 @@ Models are auto-detected from the checkpoint directory. Diffusers-format models

[^5]: Qwen-Image ships a native BF16 implementation with per-module numerical parity against `diffusers.QwenImagePipeline` (cosine similarity >= 0.999 on the full 20B transformer) and supports `trtllm-serve` / `/v1/images/generations`. VisualGen supports FP8 blockwise and NVFP4 dynamic quantization from BF16 checkpoints, as well as direct loading of statically quantized FP8 and NVFP4 ModelOpt checkpoints.

[^6]: Qwen-Image-Layered supports baseline BF16 image-conditioned layer decomposition and returns the generated RGBA layer stack as a saveable image grid. FP8 blockwise, NVFP4, cache acceleration, attention-parallel/Sage/VSA backends, Tensor Parallelism, and `trtllm-serve` image-edit routing are not enabled for this pipeline yet.

## Quick Start

Here is a simple example to generate a video with Wan 2.1:
Expand Down
2 changes: 2 additions & 0 deletions examples/visual_gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ python models/flux1.py
python models/flux2.py
python models/cosmos3_ti2v.py --prompt "A robot arm picks fruit in a grocery store"
python models/qwen_image.py
python models/qwen_image_layered.py --image /path/to/image.png
Comment thread
yibinl-nvidia marked this conversation as resolved.

# With engine config (quant, parallelism, etc.)
python models/wan_t2v.py --visual_gen_args configs/wan2.2-t2v-fp4-1gpu.yaml
Expand All @@ -32,6 +33,7 @@ python models/flux1.py --visual_gen_args configs/flux1-dev-fp4-1gpu.yaml
python models/flux2.py --visual_gen_args configs/flux2-dev-fp4-1gpu.yaml
python models/cosmos3_ti2v.py --visual_gen_args configs/cosmos3-nano-1gpu.yaml --prompt "A robot arm picks fruit in a grocery store"
python models/qwen_image.py --visual_gen_args configs/qwen-image-fp8-1gpu.yaml
python models/qwen_image_layered.py --visual_gen_args configs/qwen-image-layered-1gpu.yaml --image /path/to/image.png
```

Install deps from the repo root: `pip install -r requirements-dev.txt`.
Expand Down
24 changes: 24 additions & 0 deletions examples/visual_gen/configs/qwen-image-layered-1gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# 1-GPU Qwen-Image-Layered baseline.
# Load with VisualGenArgs.from_yaml() or example scripts that accept --visual_gen_args.
attention_config:
backend: VANILLA
parallel_config:
cfg_size: 1
ulysses_size: 1
cuda_graph_config:
enable: false
73 changes: 73 additions & 0 deletions examples/visual_gen/models/qwen_image_layered.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Comment thread
yibinl-nvidia marked this conversation as resolved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Qwen-Image-Layered image decomposition.

Usage:
python qwen_image_layered.py --image input.png
python qwen_image_layered.py --visual_gen_args ../configs/qwen-image-layered-1gpu.yaml \
--image input.png
"""

import argparse

from tensorrt_llm import VisualGen, VisualGenArgs


def parse_args() -> argparse.Namespace:
Comment thread
yibinl-nvidia marked this conversation as resolved.
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--model",
default="Qwen/Qwen-Image-Layered",
help="Hugging Face model id or local checkpoint path.",
)
parser.add_argument(
"--visual_gen_args",
"--extra_visual_gen_options",
dest="visual_gen_args",
help="Optional VisualGenArgs YAML file.",
)
parser.add_argument(
"--image",
required=True,
help="Input image path.",
)
parser.add_argument(
"--prompt",
default="",
help="Optional text prompt. Empty prompt enables image captioning.",
)
parser.add_argument(
"--output_path",
default="qwen_image_layered_output.png",
help="Path to save the layer grid image.",
)
return parser.parse_args()


def main() -> None:
args = parse_args()
extra_args = VisualGenArgs.from_yaml(args.visual_gen_args) if args.visual_gen_args else None
visual_gen = VisualGen(model=args.model, args=extra_args)

params = visual_gen.default_params
params.image = args.image

output = visual_gen.generate(inputs=args.prompt, params=params)
saved = output.save(args.output_path)
print(f"Saved image to {saved}")


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions tensorrt_llm/_torch/visual_gen/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
from .flux import Flux2Pipeline, FluxPipeline
from .ltx2 import LTX2Pipeline # noqa: F401
from .qwen_image import QwenImagePipeline
from .qwen_image_layered import QwenImageLayeredPipeline
from .wan import WanImageToVideoPipeline, WanPipeline

__all__ = [
"AutoPipeline",
"BasePipeline",
"FluxPipeline",
"Flux2Pipeline",
"QwenImageLayeredPipeline",
"QwenImagePipeline",
"WanPipeline",
"WanImageToVideoPipeline",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Qwen-Image-Layered pipeline exports."""

from .pipeline_qwen_image_layered import QwenImageLayeredPipeline
from .transformer_qwen_image_layered import QwenEmbedLayer3DRope, QwenImageLayeredTransformer2DModel

__all__ = [
"QwenEmbedLayer3DRope",
"QwenImageLayeredPipeline",
"QwenImageLayeredTransformer2DModel",
]
Loading
Loading