Update train.py
updated deprecated call
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Updated AMP (Automatic Mixed Precision) autocast usage for compatibility with PyTorch 2.0+.
π Key Changes
- Replaced
torch.cuda.amp.autocast(amp)withtorch.amp.autocast('cuda', amp)in the training script.
π― Purpose & Impact
- Purpose: Aligns the code with PyTorch 2.0+ updates, making YOLOv5 compatible with newer PyTorch versions.
- Impact: Prevents potential errors or deprecation warnings, ensuring smoother training experiences for users upgrading to the latest PyTorch versions. π
All Contributors have signed the CLA. β
Posted by the CLA Assistant Lite bot.
π Hello @ShubhamPhapale, thank you for submitting a ultralytics/yolov5 π PR! To ensure a seamless integration of your work, please review the following checklist:
- β Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
- β
Synchronize with Source: Confirm your PR is synchronized with the
ultralytics/yolov5mainbranch. If it's behind, update it by clicking the 'Update branch' button or by runninggit pullandgit merge mainlocally. - β Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
- β Update Documentation: Update the relevant documentation for any new or modified features.
- β Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
- β Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
- β Minimize Changes: Limit your changes to the minimum necessary 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
For more guidance, please refer to our Contributing Guide. Donβt hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! π
π οΈ Notes
It looks like your PR updates AMP autocast usage for compatibility with PyTorch 2.0+, which is an important improvement.
If applicable, please include a minimum reproducible example (MRE) so we can fully understand and test the impact of this change. For example, providing specific training scenarios where the prior implementation failed due to autograd issues with PyTorch 2.0+ would help validate this fix.
An Ultralytics engineer will also review this PR shortly. Stay tuned for additional feedback! π
Made with β€οΈ by Ultralytics Actions
I have read the CLA Document and I sign the CLA
π Hello there! We wanted to let you know that we've decided to close this pull request due to inactivity. We appreciate the effort you put into contributing to our project, but unfortunately, not all contributions are suitable or aligned with our product roadmap.
We hope you understand our decision, and please don't let it discourage you from contributing to open source projects in the future. We value all of our community members and their contributions, and we encourage you to keep exploring new projects and ways to get involved.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Thank you for your contributions to YOLO π and Vision AI β