-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
Update requirements.txt comment https://pytorch.org/get-started/locally/ #9576
Conversation
Added --extra-index-url https://download.pytorch.org/whl/cu116 URL to requirements file for ease of creating venv with CUDA enabled PyTorch. Otherwise CPU PyTorch is installed an unable to use local GPUs. Signed-off-by: David A. Macey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hello @davidamacey, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- ✅ Verify your PR is up-to-date with
ultralytics/yolov5
master
branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by runninggit pull
andgit merge master
locally. - ✅ Verify all YOLOv5 Continuous Integration (CI) checks are passing.
- ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee
@davidamacey thanks for the PR! This message typically appears for newer GPUs when the base torch CUDA version has not caught up yet to the new hardware. Since unfortunately there's no one-size fits all torch version it's usually worth a trip over to https://pytorch.org/get-started/locally/ to get the optimal install command for your particular situation. I don't know what effect the additional --extra-index-url would have across the userbase, but if it made sense to use this as the default then I'm sure torch would already be doing this. In contrast some CPU only installs benefit from a separate --extra-index-url, so I don't think its a good idea to include one in requirements.txt by default since it might differ with manual user additions. yolov5/.github/workflows/ci-testing.yml Line 92 in 55fbac9
|
@glenn-jocher Good Morning! Thank you for the prompt response. I appreciate the thorough answer. Given the wide range of users configurations, I understand this would be difficult to mitigate. What about amending the requirements file to include a comment to the PyTorch Link? Just a suggestion. Thanks again for taking the time to review my PR! |
Signed-off-by: Glenn Jocher <[email protected]>
Signed-off-by: Glenn Jocher <[email protected]>
@davidamacey yes good idea. I've added a comment to visit https://pytorch.org/get-started/locally/ PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
Problem: When using default requirements file, package install does not automatically included CUDA version of PyTorch, thus not allowing me to use local GPUs on my system.
Proposed Solution: Add '--extra-index-url https://download.pytorch.org/whl/cu116' URL to requirements file under any PyTorch requirement (torch, torchvision, torchaudio) for ease of creating venv with CUDA enabled PyTorch. Otherwise CPU PyTorch is installed and unable to take advantage of local GPUs.
Example:
Using my local machine using this workflow:
git clone https://github.com/ultralytics/yolov5.git
python3 -m venv .yoloenv
source .yoloenv/bin/activate
pip3 install -r requirements.txt
Opening and running tutotial.ipynb, I get the following errors:

After updating requirements with proposed changes, I removed the venv
.yoloenv
and recreated new venv (same as above).Now running tutorial.ipynb, I am able to use my GPUs with CUDA enabled:

I understand not all users have local access to GPUs; but this change will allow users to quickly reference the CUDA version of PyTorch on install. For wide dissemination, the extra-index-url could be included in requirements, but commented out for users who would like to use for installing requirements more easily.
Signed-off-by: David A. Macey [email protected]
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Enhanced installation guidance for PyTorch in the YOLOv5 requirements.
📊 Key Changes
requirements.txt
with a comment for PyTorch installation guidance.🎯 Purpose & Impact