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

Scope all hubconf.py imports for torch.hub.list() #3145

Merged
merged 2 commits into from
May 12, 2021

Conversation

glenn-jocher
Copy link
Member

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

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Streamlined dependency checks in hubconf.py for YOLOv5 models.

πŸ“Š Key Changes

  • Removed the global import of Path from pathlib.
  • Moved check_requirements and set_logging imports inside the _create function.
  • Restructured the code to check requirements only within the _create function.

🎯 Purpose & Impact

  • 🧹 Cleaner Code Organization: Importing modules only where they're needed makes the code less cluttered.
  • ⏱ Performance Improvement: May slightly improve the load time of the module by avoiding checking for requirements until necessary.
  • πŸ›  User Experience: Users can potentially see a more streamlined interaction when loading models, with more focused error messages if there are missing requirements.

@glenn-jocher glenn-jocher merged commit 06372b1 into master May 12, 2021
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-5 branch May 12, 2021 18:28
@glenn-jocher
Copy link
Member Author

glenn-jocher commented May 12, 2021

Output confirmed looks good.

torch.hub.list('ultralytics/yolov5', force_reload=True)

Downloading: "https://github.com/ultralytics/yolov5/archive/master.zip" to /Users/glennjocher/.cache/torch/hub/master.zip

['custom',
 'yolov5l',
 'yolov5l6',
 'yolov5m',
 'yolov5m6',
 'yolov5s',
 'yolov5s6',
 'yolov5x',
 'yolov5x6']

Lechtr pushed a commit to Lechtr/yolov5 that referenced this pull request Jul 20, 2021
* Scope all hubconf.py imports for torch.hub.list()

* Update hubconf.py

(cherry picked from commit 06372b1)
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Scope all hubconf.py imports for torch.hub.list()

* Update hubconf.py
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

1 participant