Replies: 3 comments 2 replies
-
(moving this to a discussion so people can find it later) TensorRT engines must be built on the device you intend to deploy it on. So the workflow I recommend is you export your model to TorchScript on your host machine, then move that file to the Jetson where you would do the Torch-TensorRT compilation. Basically just separate the code you provided into two scripts, one run on the host and one run on the Jetson.
model.cuda().eval()
model = torch.jit.trace(model, [torch.rand(1, 3, 224, 224).cuda()])
model.save("my_model.ts")
model = torch.jit.load("my_model.ts")
trt_model_fp32 = torch_tensorrt.compile(model,
inputs=[torch_tensorrt.Input((1, 3, 224, 224))],
enabled_precisions=torch.float32)
torch.jit.save(trt_model_fp32, dir) |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help. I installed torch_tensorRT on Jetson device sucessfully. I think that the documentation for installing torch_tensorrt in Jetson is confusing so I will try to sum up the steps needed here:
If you see something with
Notes: 1 - Just TensorRT 1.1.0 is compatible with JetPack < 5 |
Beta Was this translation helpful? Give feedback.
-
You just need to install the bazel binary not necessarily bazelisk. At least that is what we do. Yes right now we do not support Jetpack 5.0, that will be coming in a point release soon. |
Beta Was this translation helpful? Give feedback.
-
❓ Question
I optimized a pytorch module with torch-TensorRT. How can I move the engine to a Jetson?
What you have already tried
I tried torch.jit.load('trt_traced_model.ts')
but get torch.torch.classes.tensorrt.Engine error
Environment
Additional context
I have a Jetson NX system with jetpack 4.6, torch v0.10.0 and torchvision v0.11.0 where I want to deploy a tensorRT model.
For that in my main computer I installed this repository and converted my model to tensorRT successfully. I need to move it into the Jetson for production.
This is the code that I use to export to tensorRT (main computer)
This is in my Jetson
model = torch.jit.load(dir)
but i get torch.torch.classes.tensorrt.Engine error
Jetson hasn't installed torch-tensorRT. How can I move the tensorRT model? Do I need to install this repo also in the Jetson?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions