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

Replace model.half() with amp.autocast() #3314

Closed
wants to merge 7 commits into from

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented May 24, 2021

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced GitHub Actions and model loading, improved inference precision, and added Kaggle support.

πŸ“Š Key Changes

  • GitHub Actions now trigger on develop branch as well as master.
  • Rebase instructions in greetings.yml changed to use the develop branch.
  • Model loading uses mixed precision (FP16/FP32) during inference for efficiency.
  • The training script train.py now uses attempt_download() for cleaner code.
  • detect.py script adjustments for better GPU utilization with AMP (Automatic Mixed Precision).
  • Improvements in hubconf.py and experimental.py to streamline model checkpoint loading.
  • Kaggle badge added to tutorial.ipynb for easier access.
  • utils/google_utils.py now includes a safe_download function to handle downloads robustly.
  • Image loading now supports all channels in BGR color space in utils/datasets.py.

🎯 Purpose & Impact

  • πŸš€ Improve Continuous Integration by extending workflow checks to more branches.
  • πŸ› οΈ Provide cleaner code with better error handling for downloads.
  • πŸ’¨ Enhance inference efficiency using mixed precision to reduce memory and speed up computations.
  • ⛓️ Streamline model loading process, reducing potential for errors and redundancy.
  • 🌐 Improve user experience by enabling easier access from Kaggle.
  • πŸ“‰ Potentially reduce bugs and boost user confidence in codebase reliability.
  • πŸ‘οΈ Make the model better suited for various color channel formats, improving image handling.

@glenn-jocher
Copy link
Member Author

glenn-jocher commented May 24, 2021

Master branch appears faster. Autocast adds about 2 ms per batch :(

Screenshot 2021-05-24 at 13 30 29

@SkalskiP SkalskiP changed the base branch from master to develop May 24, 2021 20:08
SkalskiP and others added 6 commits May 27, 2021 17:01
* update ci-testing.yml

* update greetings.yml

* bring back os matrix
* update ci-testing.yml

* update greetings.yml

* bring back os matrix
* Enable direct `--weights URL` definition

@kalenmike this PR will enable direct --weights URL definition. Example use case:
```
python train.py --weights https://storage.googleapis.com/bucket/dir/model.pt
```

* cleanup

* bug fixes

* weights = attempt_download(weights)

* Update experimental.py

* Update hubconf.py

* return bug fix

* comment mirror

* min_bytes
add Open in Kaggle badge
* Update datasets.py

* comment

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member Author

/rebase

Base automatically changed from develop to master June 8, 2021 08:22
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch June 19, 2021 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants