Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run the demo on Jetson Nano #428

Open
blackjack2015 opened this issue Oct 18, 2020 · 6 comments
Open

Failed to run the demo on Jetson Nano #428

blackjack2015 opened this issue Oct 18, 2020 · 6 comments

Comments

@blackjack2015
Copy link

Dear Authors,

We have the following hardware and software configuration:

Hardware: Nvidia Jetson Nano 4GB
Software: 1. JetPack 4.4 (L4T 32.4.3); 2. PyTorch 1.6.0; 3. TensorRT 7.1.3.0

However, we failed to run even the demo example as follows:

import torch
from torch2trt import torch2trt
from torchvision.models.alexnet import alexnet

create some regular pytorch model...

model = alexnet(pretrained=True).eval().cuda()

create example data

x = torch.ones((1, 3, 224, 224)).cuda()

convert to TensorRT feeding sample data as input

model_trt = torch2trt(model, [x])

y = model(x)
y_trt = model_trt(x)

check the output against PyTorch

print(torch.max(torch.abs(y - y_trt)))

The system gives a hint of "killed". We notice that you have displayed some experimental results on Jetson Nano. Would you mind suggesting the software version, such as PyTorch or TensorRT?

Looking forward to hearing from you!

Best Regards,
Qiang Wang

@AmitNativ1984
Copy link

Any luck with this?
I am struggling with the same issue...
Thanks!

@blackjack2015
Copy link
Author

I would like to say that may be the issue of insufficient CPU main memory of the mobile device. I have successfully run it on Jetson TX2, which has 8 GB of main memory.

Any luck with this?
I am struggling with the same issue...
Thanks!

@OmmmmooooO
Copy link

OmmmmooooO commented Jan 20, 2021

I have the same issue on Jetson Nano 4GB version.
More precisely, It was 'Killed' on the line

model_trt = torch2trt(model, [x])

After enlarging the Linux swap space from 2GB(default) to 4GB, it ran successfully.

@njustczr
Copy link

njustczr commented Mar 5, 2022

jetson nano 4GB swap space12GB
i got this error:

[TensorRT] ERROR: 4: Tensor: output_0 trying to set to TensorLocation::kHOST but only kDEVICE is supported (only network inputs may be on host)
[TensorRT] WARNING: Tensor DataType is determined at build time for tensors not marked as input or output.
[TensorRT] ERROR: 4: [network.cpp::validate::2506] Error Code 4: Internal Error (Tensor: input_0 set to TensorLocation::kHOST but only kDEVICE is supported (only RNNv2 allows host input))
pytorch time: 0.0016689300537109375 ms
Traceback (most recent call last):
File "nvidia_torch2trt.py", line 23, in
y_trt = model_trt(x)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch2trt-0.3.0-py3.6.egg/torch2trt/torch2trt.py", line 466, in forward
idx = self.engine.get_binding_index(output_name)
AttributeError: 'NoneType' object has no attribute 'get_binding_index'

code:
import torch
from torch2trt import torch2trt
#from torchvision.models.alexnet import alexnet
from pytorch2onnx import PPLCNet_x2_5
import time
import tensorrt as trt

create some regular pytorch model...

model = PPLCNet_x2_5()
model.load_state_dict(torch.load('lcnet_x2_5.pth', map_location='cpu'), strict=True)
model.eval()

create example data

x = torch.ones((1, 3, 224, 224))

convert to TensorRT feeding sample data as input

model_trt = torch2trt(model, [x], fp16_mode=True, log_level=trt.Logger.INFO, strict_type_constraints=True)

for i in range(50):
s = time.time()
#y = model(x)
e = time.time()
print("pytorch time: {} ms".format((e-s)*1000.0))
y_trt = model_trt(x)
print("tensorrt time: {} ms".format((time.time()-e)*1000.0))

@SimonSongg
Copy link

I have the same issue on Jetson Nano 4GB version. More precisely, It was 'Killed' on the line

model_trt = torch2trt(model, [x])

After enlarging the Linux swap space from 2GB(default) to 4GB, it ran successfully.

I am using Jetson Xavier NX, and I added 20G swap. My process was still killed when converting the model. Only about 4G swap was used. I don't know why.

@miRemid
Copy link

miRemid commented Mar 6, 2023

I have the same issue on Jetson Nano 4GB version. More precisely, It was 'Killed' on the line

model_trt = torch2trt(model, [x])

After enlarging the Linux swap space from 2GB(default) to 4GB, it ran successfully.

jetson tx2 enlarge swap to 4GB fix the error, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants