Yolov5: can't use cuda

Created on 31 Aug 2020  路  7Comments  路  Source: ultralytics/yolov5

I create a conda env as your requirements:
cuda: 10.1
python 3.8.0
pytorch 1.6.0
torchvision: 0.7.0
but I can't use the cuda.
import torch print(torch.cuda.is_available()) # False

question

Most helpful comment

You can try it and download torch again. Use the command pip install torch==1.6.0+cu101, which may be useful.

Because I changed the source of pip, using pip install torch==1.6.0+cu101 can't install, so I installed it according to the official Python installation:
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html,
the cuda can be cused. Thank you!

All 7 comments

Hello @liguoyu666, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

My previous cuda version was 10.0锛宼oday I install cuda 10.1, conda environments are OK such as yolov4, except yolov5.

image

docker pull ultralytics/yolov5, In the docker environment锛宼he cuda can't be used either.

image

You can check whether the configuration path of cuda is correct? I remember that you need to add the path of the new version of cuda10.1 to .bashrc (in fact, you only need to modify the original cuda10.0 to 10.1).

You can check whether the configuration path of cuda is correct? I remember that you need to add the path of the new version of cuda10.1 to .bashrc (in fact, you only need to modify the original cuda10.0 to 10.1).

In fact, I installed cuda 10.0 and cuda10.1, and I modify the original cuda 10.0 to 10.1.
yolov3 and yolov4 can use cuda in their environment.
This seems to be caused by a mismatch between the cuda version and the pytorch version.
image

In the yolov5 environment, I change pytorch 1.6.0 to 1.4.0, torch.cuda.is_available() is True.
I uninstall cuda 10.0 and 10.1, then reinstall cuda 10.1, the same problem remains: in pytorch 1.6.0, torch.cuda.is_available() is False; in pytorch 1.2.0 and 1.4.0, torch.cuda.is_available() is True.
My driver version is 430.40.

You can try it and download torch again. Use the command pip install torch==1.6.0+cu101, which may be useful.

You can try it and download torch again. Use the command pip install torch==1.6.0+cu101, which may be useful.

Because I changed the source of pip, using pip install torch==1.6.0+cu101 can't install, so I installed it according to the official Python installation:
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html,
the cuda can be cused. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cswwp picture cswwp  路  4Comments

nanometer34688 picture nanometer34688  路  3Comments

ShreshthSaxena picture ShreshthSaxena  路  4Comments

jaqub-manuel picture jaqub-manuel  路  4Comments

FSNStefan picture FSNStefan  路  4Comments