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

Sudden problems about device #6448

Closed
1 task done
b860306 opened this issue Jan 27, 2022 · 17 comments · Fixed by #6461
Closed
1 task done

Sudden problems about device #6448

b860306 opened this issue Jan 27, 2022 · 17 comments · Fixed by #6461
Labels
question Further information is requested

Comments

@b860306
Copy link

b860306 commented Jan 27, 2022

Search before asking

Question

It has been used normally for a long time, and today this problem suddenly appeared 。

Traceback (most recent call last):
File "C:\Users\Administrator/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 43, in _create
device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device)
File "C:\Users\Administrator/.cache\torch\hub\ultralytics_yolov5_master\utils\torch_utils.py", line 74, in select_device
assert nd > int(max(device.split(','))), f'Invalid --device {device} request, valid devices are 0 - {nd - 1}'
AssertionError: Invalid --device 0 request, valid devices are 0 - -1

Additional

none

@b860306 b860306 added the question Further information is requested label Jan 27, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2022

👋 Hello @b860306, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@RossLeeThomas
Copy link

Same error my side. Also running on Windows.
Been running for a few months, only stopped working on the latest pull. If I revert back to an older repo it works again.
Seems to be related to the recent GPU selection fixes on Windows?

Traceback (most recent call last):
File "c:\Gitlab\yolov5\hubconf.py", line 43, in _create
device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device)
File "c:\Gitlab\yolov5\utils\torch_utils.py", line 74, in select_device
assert nd > int(max(device.split(','))), f'Invalid --device {device} request, valid devices are 0 - {nd - 1}'
AssertionError: Invalid --device 0 request, valid devices are 0 - -1

@b860306
Copy link
Author

b860306 commented Jan 27, 2022

Same error my side. Also running on Windows. Been running for a few months, only stopped working on the latest pull. If I revert back to an older repo it works again. Seems to be related to the recent GPU selection fixes on Windows?

Traceback (most recent call last): File "c:\Gitlab\yolov5\hubconf.py", line 43, in _create device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device) File "c:\Gitlab\yolov5\utils\torch_utils.py", line 74, in select_device assert nd > int(max(device.split(','))), f'Invalid --device {device} request, valid devices are 0 - {nd - 1}' AssertionError: Invalid --device 0 request, valid devices are 0 - -1

Sorry , can i ask you how to revert back to an older repo?

@RossLeeThomas
Copy link

I changed to another branch on git updated 21 hours ago 'updates/benchmarks'.

@RossLeeThomas
Copy link

Reverting this commit (856d4e5) also fixes the issue for me.

@b860306
Copy link
Author

b860306 commented Jan 27, 2022

Reverting this commit (856d4e5) also fixes the issue for me.

I followed the steps (856d4e5)
Both profiles( torch_utils.py / datasets.py ) were updated .

But it's still the same problem

@RossLeeThomas
Copy link

created a fork you can try download, same as master branch just with the last commit reverted. https://github.com/RossLeeThomas/yolov5.git

@b860306
Copy link
Author

b860306 commented Jan 27, 2022

創建了一個分支,您可以嘗試下載,與主分支相同,只是還原了最後一次提交。 https://github.com/RossLeeThomas/yolov5.git

Oh ! it works again.
You've saved my life.

@StevenLi-phoenix
Copy link

Have the same issue with jetson

@glenn-jocher
Copy link
Member

Sorry guys, it looks like a recent PR #6434 broke Windows GPU compatibility. I'll work on a fix ASAP.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 28, 2022

In the meantime you can checkout the previous commit easily with this code:

git clone https://github.com/ultralytics/yolov5
cd yolov5
git checkout fe7de6a82da3444d755453f86f40b508f3b99419

@StevenLi-phoenix
Copy link

Sorry guys, it looks like a recent PR #6434 broke Windows GPU compatibility. I'll work on a fix ASAP.

It does not work with jetson tx2 too.

截屏2022-01-28 下午2 35 31

without the option of device It works fine.
But as soon as I select device 0. It became out of range.
how can I select device between 0 and -1. It's impossible.

@glenn-jocher
Copy link
Member

@b860306 @RossLeeThomas @StevenLi-phoenix good news 😃! Your original issue may now be fixed ✅ in PR #6461. To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@RossLeeThomas
Copy link

Working for me. Thanks @glenn-jocher

@glenn-jocher
Copy link
Member

@RossLeeThomas great! Thanks for the feedback.

@Gowtham-369
Copy link

Search before asking

Question

It has been used normally for a long time, and today this problem suddenly appeared 。

Traceback (most recent call last): File "C:\Users\Administrator/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 43, in _create device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device) File "C:\Users\Administrator/.cache\torch\hub\ultralytics_yolov5_master\utils\torch_utils.py", line 74, in select_device assert nd > int(max(device.split(','))), f'Invalid --device {device} request, valid devices are 0 - {nd - 1}' AssertionError: Invalid --device 0 request, valid devices are 0 - -1

Additional

none

Same error I faced today while hosting using flask. Tried all the available suggestions but no solution found
Traceback (most recent call last): File "/home/ugrdsa/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 43, in _create device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device) File "/home/ugrdsa/.cache/torch/hub/ultralytics_yolov5_master/utils/torch_utils.py", line 79, in select_device LOGGER.info(s.encode().decode('ascii', 'ignore') if platform.system() == 'Windows' else s) # emoji-safe File "/usr/lib/python3.8/logging/__init__.py", line 1434, in info self._log(INFO, msg, args, **kwargs) File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log self.handle(record) File "/usr/lib/python3.8/logging/__init__.py", line 1587, in handle self.callHandlers(record) File "/usr/lib/python3.8/logging/__init__.py", line 1649, in callHandlers hdlr.handle(record) File "/usr/lib/python3.8/logging/__init__.py", line 950, in handle self.emit(record) File "/usr/lib/python3.8/logging/__init__.py", line 1084, in emit stream.write(msg + self.terminator)

@glenn-jocher
Copy link
Member

glenn-jocher commented Apr 19, 2022

@Gowtham-369 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible to produce the problem
  • Complete – Provide all parts someone else needs to reproduce the problem
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem

For Ultralytics to provide assistance your code should also be:

  • Current – Verify that your code is up-to-date with GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been solved in master.
  • Unmodified – Your problem must be reproducible using official YOLOv5 code without changes. Ultralytics does not provide support for custom code ⚠️.

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

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

Successfully merging a pull request may close this issue.

5 participants