AssertionError: CUDA unavailable, invalid device 0 requested on jetson Nano

Hi i am runnng yolov5 on jetson nano. Cant seem to get GPU to work.
Used both jetpack 4.4.1 & 4.5 version.
Still no success.
Driver installed.
root@f44cb67ac6b7:/yolov5/docker_yolov5/standard# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_21:14:42_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

Here is yolov5 on docker container
root@f44cb67ac6b7:/yolov5/docker_yolov5/standard# python3 detect.py --source ./data/images/zidane.jpg --conf 0.5
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.5, device=‘’, exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name=‘exp’, nosave=False, project=‘runs/detect’, save_conf=False, save_crop=False, save_txt=False, source=‘./data/images/zidane.jpg’, update=False, view_img=False, weights=‘yolov5s.pt’)
/usr/local/lib/python3.6/dist-packages/torch/cuda/init.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from Official Drivers | NVIDIA (Triggered internally at /media/nvidia/WD_NVME/PyTorch/JetPack_4.4.1/pytorch-v1.7.0/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
YOLOv5 \U0001f680 v5.0-75-g91547ed torch 1.7.0 CPU

Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt to yolov5s.pt…
100%|######################################| 14.1M/14.1M [00:02<00:00, 7.33MB/s]

Fusing layers…
Model Summary: 224 layers, 7266973 parameters, 0 gradients
image 1/1 /yolov5/docker_yolov5/standard/data/images/zidane.jpg: 384x640 2 persons, 1 tie, Done. (1.313s)
Results saved to runs/detect/exp
Done. (1.469s)

(env) test1@test1-desktop:~/thesis/yolov5$ python3 detect.py --weights burn_best.pt --source video6.mov
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device=‘’, exist_ok=False, half=False, hide_conf=False, hide_labels=False, imgsz=640, iou_thres=0.45, line_thickness=3, max_det=1000, name=‘exp’, nosave=False, project=‘runs/detect’, save_conf=False, save_crop=False, save_txt=False, source=‘video6.mov’, update=False, view_img=False, weights=[‘burn_best.pt’])
YOLOv5 🚀 v5.0-187-g6062319 torch 1.8.1 CPU

when manually select GPU
python3 detect.py --source ./data/images/zidane.jpg --conf 0.5 --device 0
AssertionError: CUDA unavailable, invalid device 0 requested

Kindly anyone help me find solution for this
Thanks everyone

Hi,

It looks like your PyTorch doesn’t support GPU.
How do you install the package?

You can find our prebuilt PyTorch for Jetson in the below topic:

Thanks.

@AastaLLL
I have done everything. Using the latest pytorch 1.8.1 and 1,7.
I have run the configuration on following settings.
1.Jetpack 4.5.1 and virtual env of python 3.8
Install the requirement using pip install -r requirement .txt
2. Run a docker image om jetpack 4.5.1

  1. Jetpack 4.4.1 and virtual env of python 3.8
    Install the requirement using pip install -r requirement .txt
  2. Run a docker image om jetpack 4.4.1

No GPU working.

Hi,

Is your PyTorch package downloaded from the topic shared in Jun 14?
We can get CUDA work correctly with that pacakge:

$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.8.0'
>>> torch.cuda.is_available()
True

It looks like you are using python 3.8.
Do you build the package on your own?
If yes, have you enabled the CUDA support?

Thanks.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.