Skip to content

fix: docs + new dep group#4060

Open
narendasan wants to merge 1 commit intomainfrom
push-uksszqwqpuxx
Open

fix: docs + new dep group#4060
narendasan wants to merge 1 commit intomainfrom
push-uksszqwqpuxx

Conversation

@narendasan
Copy link
Collaborator

Description

Fix documentation building

Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla meta-cla bot added the cla signed label Jan 29, 2026
@github-actions github-actions bot added documentation Improvements or additions to documentation component: build system Issues re: Build system labels Jan 29, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:50:57.564183+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:51:30.211201+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)

torch.manual_seed(0)

# %%
+

# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attention

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:52:54.555414+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:53:26.945609+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)

torch.manual_seed(0)

# %%
+

# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attention

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:54:57.305479+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py	2026-01-29 19:55:29.533323+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)

torch.manual_seed(0)

# %%
+

# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attention

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/autocast_example.py	2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/autocast_example.py	2026-01-29 19:58:29.240203+00:00
@@ -104,21 +104,19 @@
should_be_fp16 = [
    autocast_outs[8],
]
should_be_bf16 = [autocast_outs[3], autocast_outs[4], autocast_outs[6]]

-assert all(a.dtype == torch.float32 for a in should_be_fp32), (
-    "Some Autocast outputs are not float32!"
-)
-assert all(a.dtype == torch.float16 for a in should_be_fp16), (
-    "Some Autocast outputs are not float16!"
-)
-assert all(a.dtype == torch.bfloat16 for a in should_be_bf16), (
-    "Some Autocast outputs are not bfloat16!"
-)
+assert all(
+    a.dtype == torch.float32 for a in should_be_fp32
+), "Some Autocast outputs are not float32!"
+assert all(
+    a.dtype == torch.float16 for a in should_be_fp16
+), "Some Autocast outputs are not float16!"
+assert all(
+    a.dtype == torch.bfloat16 for a in should_be_bf16
+), "Some Autocast outputs are not bfloat16!"
for i, (a, w) in enumerate(zip(autocast_outs, pytorch_outs)):
    assert torch.allclose(
        a.to(torch.float32), w.to(torch.float32), atol=1e-2, rtol=1e-2
-    ), (
-        f"Autocast and Pytorch outputs do not match! autocast_outs[{i}] = {a}, pytorch_outs[{i}] = {w}"
-    )
+    ), f"Autocast and Pytorch outputs do not match! autocast_outs[{i}] = {a}, pytorch_outs[{i}] = {w}"
print("All dtypes and values match!")
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/refit_engine_example.py	2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/refit_engine_example.py	2026-01-29 19:58:29.373306+00:00
@@ -103,13 +103,13 @@
    expected_outputs, refitted_outputs = (
        exp_program2.module()(*inputs),
        new_trt_gm(*inputs),
    )
    for expected_output, refitted_output in zip(expected_outputs, refitted_outputs):
-        assert torch.allclose(expected_output, refitted_output, 1e-2, 1e-2), (
-            "Refit Result is not correct. Refit failed"
-        )
+        assert torch.allclose(
+            expected_output, refitted_output, 1e-2, 1e-2
+        ), "Refit Result is not correct. Refit failed"

print("Refit successfully!")

# %%
#
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/nvrtc_aot_plugin.py	2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/nvrtc_aot_plugin.py	2026-01-29 19:58:29.417137+00:00
@@ -237,10 +237,10 @@

        print("Running inference with compiled model...")
        with torch.no_grad():
            for i in range(10):
                res = model_trt(input)
-                assert torch.allclose(res, model(input), rtol=1e-2, atol=1e-2), (
-                    "Results do not match!"
-                )
+                assert torch.allclose(
+                    res, model(input), rtol=1e-2, atol=1e-2
+                ), "Results do not match!"

    print("Inference successful!")
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/mutable_torchtrt_module_example.py	2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/mutable_torchtrt_module_example.py	2026-01-29 19:58:29.464922+00:00
@@ -55,13 +55,13 @@
# Check the output
# The refit happens while you call the mutable module again.
with torch.no_grad():
    expected_outputs, refitted_outputs = model2(*inputs), mutable_module(*inputs)
for expected_output, refitted_output in zip(expected_outputs, refitted_outputs):
-    assert torch.allclose(expected_output, refitted_output, 1e-2, 1e-2), (
-        "Refit Result is not correct. Refit failed"
-    )
+    assert torch.allclose(
+        expected_output, refitted_output, 1e-2, 1e-2
+    ), "Refit Result is not correct. Refit failed"

print("Refit successfully!")

# %%
# Saving Mutable Torch TensorRT Module

Copy link
Collaborator

@lanluo-nvidia lanluo-nvidia left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: build system Issues re: Build system documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants