[https://nvbugs/6290967][fix] Update the two Cosmos3 quant assertions to read…#15264
[https://nvbugs/6290967][fix] Update the two Cosmos3 quant assertions to read…#15264tensorrt-cicd wants to merge 1 commit into
Conversation
…ant_algo assertion Cosmos3 FP8 tests asserted on pipeline.model_config.quant_config, but BasePipeline only exposes pipeline_config (a DiffusionPipelineConfig) and config; there is no model_config attribute on the pipeline itself. The per-component quant_config lives on pipeline_config.primary_model_config (i.e. model_configs['transformer']), which is the existing public API. Update both Cosmos3 quant tests to use it. Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
📝 WalkthroughWalkthroughTwo test assertions validate FP8 quantization configuration in Cosmos3 pipeline tests. Both update the assertion path from ChangesFP8 Quantization Config Path Validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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.
🧹 Nitpick comments (2)
tests/unittest/_torch/visual_gen/test_cosmos3_pipeline.py (1)
271-271: 💤 Low valueConsider verifying the specific quantization algorithm value.
The assertion checks that
quant_algois not None, but could be strengthened to verify it matches the expectedQuantAlgo.FP8value since the test explicitly loads FP8 configuration. This would catch configuration parsing issues more precisely.♻️ Optional: More precise assertion
+from tensorrt_llm.models.modeling_utils import QuantAlgo + def test_fp8_load_and_t2v(self): checkpoint = _require_checkpoint() pipeline = _load_pipeline(checkpoint, quant_config=COSMOS3_FP8_QUANT_CONFIG) try: - assert pipeline.pipeline_config.primary_model_config.quant_config.quant_algo is not None + assert pipeline.pipeline_config.primary_model_config.quant_config.quant_algo == QuantAlgo.FP8 result = _run_forward(pipeline, image=None, num_frames=NUM_FRAMES)🤖 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/unittest/_torch/visual_gen/test_cosmos3_pipeline.py` at line 271, Replace the loose non-null check with a precise equality assertion: assert that pipeline.pipeline_config.primary_model_config.quant_config.quant_algo == QuantAlgo.FP8 so the test verifies the parsed quantization algorithm matches the expected FP8 value (use the QuantAlgo enum and the existing pipeline.pipeline_config.primary_model_config.quant_config.quant_algo identifier).tests/unittest/_torch/visual_gen/test_cosmos3_transformer.py (1)
298-298: 💤 Low valueConsider verifying the specific quantization algorithm value.
Similar to the pipeline test, this assertion could be strengthened to verify the parsed
quant_algomatches the expectedQuantAlgo.FP8enum value from the input configuration string. This provides more precise validation of the config parsing logic.♻️ Optional: More precise assertion
+from tensorrt_llm.models.modeling_utils import QuantAlgo + `@pytest.mark.parametrize`("quant_algo", ["FP8"]) def test_load_fp8_quantization(self, quant_algo: str): checkpoint_dir = _require_checkpoint() if not torch.cuda.is_available(): pytest.skip("CUDA not available") args = VisualGenArgs( model=checkpoint_dir, quant_config={**COSMOS3_FP8_QUANT_CONFIG, "quant_algo": quant_algo}, torch_compile_config=TorchCompileConfig(enable=False), ) pipeline = PipelineLoader(args).load(skip_warmup=True, skip_components=_SKIP_AUX) try: - assert pipeline.pipeline_config.primary_model_config.quant_config.quant_algo is not None + assert pipeline.pipeline_config.primary_model_config.quant_config.quant_algo == QuantAlgo.FP8 transformer = pipeline.transformer🤖 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/unittest/_torch/visual_gen/test_cosmos3_transformer.py` at line 298, The test currently only checks that pipeline.pipeline_config.primary_model_config.quant_config.quant_algo is not None; update the assertion to verify the exact enum value by asserting it equals QuantAlgo.FP8 (import QuantAlgo from the module where it’s defined) so the test confirms the parsed quant_algo matches the expected FP8 value instead of just non-null.
🤖 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.
Nitpick comments:
In `@tests/unittest/_torch/visual_gen/test_cosmos3_pipeline.py`:
- Line 271: Replace the loose non-null check with a precise equality assertion:
assert that
pipeline.pipeline_config.primary_model_config.quant_config.quant_algo ==
QuantAlgo.FP8 so the test verifies the parsed quantization algorithm matches the
expected FP8 value (use the QuantAlgo enum and the existing
pipeline.pipeline_config.primary_model_config.quant_config.quant_algo
identifier).
In `@tests/unittest/_torch/visual_gen/test_cosmos3_transformer.py`:
- Line 298: The test currently only checks that
pipeline.pipeline_config.primary_model_config.quant_config.quant_algo is not
None; update the assertion to verify the exact enum value by asserting it equals
QuantAlgo.FP8 (import QuantAlgo from the module where it’s defined) so the test
confirms the parsed quant_algo matches the expected FP8 value instead of just
non-null.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 6658c322-b81d-491c-bdd4-4beaa1c6952c
📒 Files selected for processing (2)
tests/unittest/_torch/visual_gen/test_cosmos3_pipeline.pytests/unittest/_torch/visual_gen/test_cosmos3_transformer.py
Summary
pipeline.model_config, but BasePipeline exposes onlypipeline_config/config— nomodel_configattribute exists on the pipeline.pipeline.pipeline_config.primary_model_config.quant_config.quant_algo, avoiding any new public-API surface on the user-facing pipeline class.Test plan
Links
Summary by CodeRabbit