You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👋 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.
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
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
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?
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.
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.
Docker – sudo docker pull ultralytics/yolov5:latest to update your image
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 🚀!
I have searched the YOLOv5 issues and discussions and found no similar questions.
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)
@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 Reporttemplate with a minimum reproducible example to help us better understand and diagnose your problem.
Activity
github-actions commentedon 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:
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
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 commentedon 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 0request, valid devices are 0 - -1b860306 commentedon Jan 27, 2022
Sorry , can i ask you how to revert back to an older repo?
RossLeeThomas commentedon Jan 27, 2022
I changed to another branch on git updated 21 hours ago 'updates/benchmarks'.
RossLeeThomas commentedon Jan 27, 2022
Reverting this commit (856d4e5) also fixes the issue for me.
b860306 commentedon Jan 27, 2022
I followed the steps (856d4e5)
Both profiles( torch_utils.py / datasets.py ) were updated .
But it's still the same problem
RossLeeThomas commentedon Jan 27, 2022
created a fork you can try download, same as master branch just with the last commit reverted. https://github.com/RossLeeThomas/yolov5.git
b860306 commentedon Jan 27, 2022
Oh ! it works again.
You've saved my life.
StevenLi-phoenix commentedon Jan 27, 2022
Have the same issue with jetson
glenn-jocher commentedon Jan 28, 2022
Sorry guys, it looks like a recent PR #6434 broke Windows GPU compatibility. I'll work on a fix ASAP.
glenn-jocher commentedon 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 fe7de6a82da3444d755453f86f40b508f3b99419StevenLi-phoenix commentedon Jan 28, 2022
It does not work with jetson tx2 too.
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 commentedon Jan 28, 2022
@b860306 @RossLeeThomas @StevenLi-phoenix good news 😃! Your original issue may now be fixed ✅ in PR #6461. To receive this update:
git pullfrom within youryolov5/directory orgit clone https://github.com/ultralytics/yolov5againmodel = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)sudo docker pull ultralytics/yolov5:latestto update your imageThank 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 commentedon Jan 28, 2022
Working for me. Thanks @glenn-jocher
glenn-jocher commentedon Jan 28, 2022
@RossLeeThomas great! Thanks for the feedback.
Gowtham-369 commentedon Apr 18, 2022
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 commentedon 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:
For Ultralytics to provide assistance your code should also be:
git pullorgit clonea new copy to ensure your problem has not already been solved in master.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! 😃