You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -73,7 +74,7 @@ For `ir=ts`, this behavior stays the same in 2.X versions as well.
73
74
74
75
model = MyModel().eval().cuda()
75
76
inputs = [torch.randn((1, 3, 224, 224)).cuda()]
76
-
trt_ts = torch_tensorrt.compile(model, ir="ts", inputs=inputs) # Output is a ScriptModule object
77
+
trt_ts = torch_tensorrt.compile(model, ir="ts", arg_inputs=inputs) # Output is a ScriptModule object
77
78
torch.jit.save(trt_ts, "trt_model.ts")
78
79
79
80
# Later, you can load it and run inference
@@ -98,3 +99,26 @@ Here's an example usage
98
99
inputs = [torch.randn((1, 3, 224, 224)).cuda()]
99
100
model = torch_tensorrt.load(<file_path>).module()
100
101
model(*inputs)
102
+
103
+
b) PT2 Format
104
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
+
106
+
PT2 is a new format that allows models to be run outside of Python in the future. It utilizes `AOTInductor <https://docs.pytorch.org/docs/main/torch.compiler_aot_inductor.html>`_
107
+
to generate kernels for components that will not be run in TensorRT.
108
+
109
+
Here's an example on how to save and load Torch-TensorRT Module using AOTInductor in Python
"Input model is of type nn.Module. Saving nn.Module directly is not supported. Supported model types torch.jit.ScriptModule | torch.fx.GraphModule | torch.export.ExportedProgram."
"Provided model is a torch.jit.ScriptModule but the output_format specified is exported_program. Please verify the output_format"
639
+
"Provided model is a torch.jit.ScriptModule but the output_format specified is not torchscript. Other output formats are not supported"
639
640
)
640
641
else:
641
642
ifarg_inputsisnotNone:
@@ -653,7 +654,22 @@ def save(
653
654
logger.warning(
654
655
"Provided model is a torch.export.ExportedProgram, inputs or arg_inputs is not necessary during save, it uses the inputs or arg_inputs provided during export and compile"
Copy file name to clipboardExpand all lines: pyproject.toml
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ requires = [
9
9
"typing-extensions>=4.7.0",
10
10
"future>=0.18.3",
11
11
"tensorrt-cu12>=10.11.0,<10.12.0; 'tegra' not in platform_release",
12
-
"tensorrt>=10.3.0,<10.4.0; 'tegra' in platform_release",
12
+
"tensorrt-cu12>=10.3.0,<10.4.0; 'tegra' not in platform_release",
13
13
"torch>=2.8.0.dev,<2.9.0; 'tegra' not in platform_release",
14
14
"torch>=2.7.0,<2.8.0; 'tegra' in platform_release",
15
15
"pybind11==2.6.2",
@@ -63,7 +63,6 @@ dependencies = [
63
63
64
64
"tensorrt>=10.11.0,<10.12.0; 'tegra' not in platform_release",
65
65
"tensorrt>=10.3.0,<10.4.0; 'tegra' in platform_release",
66
-
67
66
"tensorrt-cu12>=10.11.0,<10.12.0; 'tegra' not in platform_release",
68
67
"tensorrt-cu12-bindings>=10.11.0,<10.12.0; 'tegra' not in platform_release",
69
68
"tensorrt-cu12-libs>=10.11.0,<10.12.0; 'tegra' not in platform_release",
@@ -99,8 +98,7 @@ torchvision = [
99
98
"torchvision",
100
99
] #Leaving torchvisions dependency unconstrained so uv can just install something that should work for the torch we have. TV's on PyT makes it hard to put version constrains in
0 commit comments