Skip to content

[TRTLLM-11358][test] Add trtllm-serve e2e tests for FLUX#12153

Merged
JunyiXu-nv merged 3 commits intoNVIDIA:mainfrom
JunyiXu-nv:user/junyix/trtllm-11358-flux-serve-e2e-tests
Mar 19, 2026
Merged

[TRTLLM-11358][test] Add trtllm-serve e2e tests for FLUX#12153
JunyiXu-nv merged 3 commits intoNVIDIA:mainfrom
JunyiXu-nv:user/junyix/trtllm-11358-flux-serve-e2e-tests

Conversation

@JunyiXu-nv
Copy link
Collaborator

@JunyiXu-nv JunyiXu-nv commented Mar 12, 2026

Summary by CodeRabbit

  • Tests
    • Extended test suite to include FLUX.1 and FLUX.2 text-to-image model testing
    • Added base64 image output validation to verify result integrity
    • Introduced configurable model paths via environment variables for FLUX models
    • Maintained compatibility with existing tests while expanding test capabilities

Description

FLUX is now supported by VisualGen for text-to-image generation. This PR adds
end-to-end tests for the trtllm-serve stack to protect FLUX functionality
through the serve API.

Changes:

  • Added TestFlux1TextToImage test class for FLUX.1-dev model
  • Added TestFlux2TextToImage test class for FLUX.2-dev model
  • Each class tests:
    • Health check endpoint
    • Synchronous text-to-image generation via POST /v1/images/generations with base64 response
    • Image generation with optional parameters (guidance_scale, negative_prompt, seed, size)
  • Model paths configurable via FLUX1_MODEL_PATH / FLUX2_MODEL_PATH env vars,
    defaulting to {LLM_MODELS_ROOT}/FLUX.1-dev and {LLM_MODELS_ROOT}/FLUX.2-dev
  • Tests are skipped when model checkpoints are not available (same pattern as WAN tests)
  • Updated module docstring to include FLUX test usage examples

Test Coverage

  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux1TextToImage::test_health
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux1TextToImage::test_t2i_sync_b64
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux1TextToImage::test_t2i_sync_with_optional_params
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux2TextToImage::test_health
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux2TextToImage::test_t2i_sync_b64
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py::TestFlux2TextToImage::test_t2i_sync_with_optional_params

Test collection verified: all 16 tests (10 existing + 6 new) collect successfully.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why.

  • PR Follows TRT-LLM CODING GUIDELINES.

  • Test cases are provided for new code paths.

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

@JunyiXu-nv JunyiXu-nv requested a review from a team as a code owner March 12, 2026 09:32
@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

The PR adds FLUX.1 and FLUX.2 text-to-image model support to an E2E test suite, introducing model path constants, two new test classes with synchronous text-to-image generation tests, and base64 image validation. Existing WAN tests remain unchanged with conditional skip logic.

Changes

Cohort / File(s) Summary
FLUX Text-to-Image Test Support
tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py
Adds _FLUX1_PATH and _FLUX2_PATH model constants with environment variable overrides. Introduces TestFlux1TextToImage and TestFlux2TextToImage test classes that perform health checks and text-to-image generation with base64 output validation. Imports base64 module and updates docstring to reflect t2i test coverage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: adding end-to-end tests for FLUX models in trtllm-serve. It includes the ticket number, type, and concise summary.
Description check ✅ Passed The PR description comprehensively explains the changes, provides detailed test coverage information, and follows the required template structure with clear sections.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
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: 3

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

Inline comments:
In `@tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py`:
- Around line 503-521: Update the two optional-parameter tests
(test_t2i_sync_with_optional_params and the similar test at lines 571-589) to
validate the returned b64_json payload contents rather than only its presence:
copy the decode/size/assertions used in test_t2i_sync_b64 (decode base64,
convert to bytes, assert non-empty and expected image dimensions or valid image
format) and apply them to data["data"][0]["b64_json"] so malformed payloads fail
the test.
- Around line 17-26: Update the example pytest commands so they point to the
actual test module path used in this repo; replace occurrences of
tests/visual_gen/test_trtllm_serve_e2e.py with
tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py in all example lines
(the commands that run TestWanTextToVideo, TestWanImageToVideo,
TestFlux1TextToImage, and TestFlux2TextToImage) so the provided examples execute
the correct module.
- Around line 477-517: Add a module-level timeout constant (e.g.,
REQUEST_TIMEOUT_S = 60) and pass it as timeout=REQUEST_TIMEOUT_S to every
requests.get/requests.post call in the test classes; specifically update the
requests callsites in the test_health, test_t2i_sync_b64, and
test_t2i_sync_with_optional_params methods (and the corresponding methods in the
other FLUX test class) so each HTTP call includes timeout=REQUEST_TIMEOUT_S to
avoid indefinite hangs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e4860d57-9de2-4de1-b7af-00a797e65f5a

📥 Commits

Reviewing files that changed from the base of the PR and between adfc542 and 31e82ff.

📒 Files selected for processing (1)
  • tests/unittest/_torch/visual_gen/test_trtllm_serve_e2e.py

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38708 [ run ] triggered by Bot. Commit: 31e82ff Link to invocation

@JunyiXu-nv JunyiXu-nv requested a review from zhenhuaw-me March 12, 2026 11:04
@tensorrt-cicd
Copy link
Collaborator

PR_Github #38708 [ run ] completed with state SUCCESS. Commit: 31e82ff
/LLM/main/L0_MergeRequest_PR pipeline #30026 completed with status: 'SUCCESS'

CI Report

Link to invocation

Copy link
Member

@zhenhuaw-me zhenhuaw-me left a comment

Choose a reason for hiding this comment

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

LGTM. thanks!

@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39215 [ run ] triggered by Bot. Commit: ba29d6f Link to invocation

@tensorrt-cicd
Copy link
Collaborator

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

@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39356 [ run ] triggered by Bot. Commit: ba29d6f Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39356 [ run ] completed with state FAILURE. Commit: ba29d6f
/LLM/main/L0_MergeRequest_PR pipeline #30600 completed with status: 'ABORTED'

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

@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39417 [ run ] triggered by Bot. Commit: ba29d6f Link to invocation

@tensorrt-cicd
Copy link
Collaborator

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

@JunyiXu-nv JunyiXu-nv force-pushed the user/junyix/trtllm-11358-flux-serve-e2e-tests branch from ba29d6f to af90d91 Compare March 18, 2026 08:45
@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39426 [ run ] triggered by Bot. Commit: af90d91 Link to invocation

@tensorrt-cicd
Copy link
Collaborator

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

@JunyiXu-nv JunyiXu-nv requested a review from a team as a code owner March 19, 2026 07:11
@JunyiXu-nv JunyiXu-nv requested review from QiJune and hchings and removed request for hchings March 19, 2026 07:11
- Add TestFlux1TextToImage for FLUX.1-dev text-to-image generation
- Add TestFlux2TextToImage for FLUX.2-dev text-to-image generation
- Tests cover health check, sync image generation via /v1/images/generations,
  and optional params (guidance_scale, negative_prompt, seed, size)
- Follow existing WAN e2e test patterns with RemoteVisualGenServer
- Model paths configurable via FLUX1_MODEL_PATH / FLUX2_MODEL_PATH env vars

Signed-off-by: Junyi Xu <219237550+JunyiXu-nv@users.noreply.github.com>
- Remove _model_available skipif from all test classes so missing models
  fail loudly on CI instead of being silently skipped
- Simplify FLUX model paths to use _llm_models_root() directly (same
  pattern as WAN), removing unnecessary env-var overrides
- Fix pytest command paths in docstring to match actual module location
- Add REQUEST_TIMEOUT_S (600s) to all FLUX HTTP requests to prevent
  indefinite hangs
- Extract _assert_b64_image_response() helper and apply it to all
  b64_json response validations including optional-param tests

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
- MediaStorage._to_pil_image() now squeezes 4D tensors (B, H, W, C)
  to 3D (H, W, C) before calling Image.fromarray(), fixing
  "Cannot handle this data type: (1, 1, 512, 3), |u1" error when
  FLUX pipelines return batched image tensors via b64_json response.

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv JunyiXu-nv force-pushed the user/junyix/trtllm-11358-flux-serve-e2e-tests branch from 2c10eb9 to 6ca25db Compare March 19, 2026 07:13
@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #39560 [ run ] triggered by Bot. Commit: 6ca25db Link to invocation

@JunyiXu-nv JunyiXu-nv enabled auto-merge (squash) March 19, 2026 13:28
@tensorrt-cicd
Copy link
Collaborator

PR_Github #39560 [ run ] completed with state SUCCESS. Commit: 6ca25db
/LLM/main/L0_MergeRequest_PR pipeline #30777 completed with status: 'SUCCESS'

CI Report

Link to invocation

@JunyiXu-nv JunyiXu-nv merged commit 1ad9714 into NVIDIA:main Mar 19, 2026
5 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.

4 participants