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
Signed-off-by: Dheeraj Peri <[email protected]>
chore: updates
Signed-off-by: Dheeraj Peri <[email protected]>
chore: remove dynamo_export file since it has been moved
Signed-off-by: Dheeraj Peri <[email protected]>
chore: updates
Signed-off-by: Dheeraj Peri <[email protected]>
chore: updates
Signed-off-by: Dheeraj Peri <[email protected]>
Pytorch 2.1 introduced ``torch.export`` APIs which
15
13
can export graphs from Pytorch programs into ``ExportedProgram`` objects. Torch-TensorRT dynamo
16
14
frontend compiles these ``ExportedProgram`` objects and optimizes them using TensorRT. Here's a simple
@@ -43,8 +41,7 @@ Some of the frequently used options are as follows:
43
41
44
42
The complete list of options can be found `here <https://github.com/pytorch/TensorRT/blob/123a486d6644a5bbeeec33e2f32257349acc0b8f/py/torch_tensorrt/dynamo/compile.py#L51-L77>`_
45
43
46
-
.. note:: We do not support INT precision currently in Dynamo. Support for this currently exists in
47
-
our Torchscript IR. We plan to implement similar support for dynamo in our next release.
44
+
.. note:: We do not support INT precision currently in Dynamo. Support for this currently exists in our Torchscript IR. We plan to implement similar support for dynamo in our next release.
`torch_tensorrt.dynamo.export` inlines the submodules within a GraphModule to their corresponding nodes, stiches all the nodes together and creates an ExportedProgram.
64
65
This is needed as `torch.export` serialization cannot handle serializing and deserializing of submodules (`call_module` nodes).
65
66
66
-
NOTE: This way of saving the models using `ExportedProgram` is experimental. Here is a known issue : https://github.com/pytorch/TensorRT/issues/2341
67
+
.. note:: This way of saving the models using `ExportedProgram` is experimental. Here is a known issue : https://github.com/pytorch/TensorRT/issues/2341
67
68
68
69
69
70
Torchscript IR
70
71
-------------
71
72
72
-
In Torch-TensorRT 1.X versions, the primary way to compile and run inference with Torch-TensorRT is using Torchscript IR.
73
-
This behavior stays the same in 2.X versions as well.
73
+
In Torch-TensorRT 1.X versions, the primary way to compile and run inference with Torch-TensorRT is using Torchscript IR.
74
+
This behavior stays the same in 2.X versions as well.
74
75
75
-
.. code-block:: python
76
+
.. code-block:: python
76
77
77
-
import torch
78
-
import torch_tensorrt
78
+
import torch
79
+
import torch_tensorrt
79
80
80
-
model = MyModel().eval().cuda()
81
-
inputs = torch.randn((1, 3, 224, 224)).cuda()
82
-
trt_ts = torch_tensorrt.compile(model, ir="ts", inputs) # Output is a ScriptModule object
83
-
torch.jit.save(trt_ts, "trt_model.ts")
81
+
model = MyModel().eval().cuda()
82
+
inputs =[torch.randn((1, 3, 224, 224)).cuda()]
83
+
trt_ts = torch_tensorrt.compile(model, ir="ts", inputs) # Output is a ScriptModule object
0 commit comments