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 imports for torch.hub.list() improvement #3144

Merged
merged 1 commit 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

Refactoring of model creation functions in hubconf.py.

πŸ“Š Key Changes

  • Renamed create function to _create to indicate a private method not intended for external use.
  • Delayed imports inside the _create function to potentially reduce import time and memory usage.
  • Updated function calls from create to _create throughout the file.

🎯 Purpose & Impact

  • The renaming hints to the developers that _create is an internal utility function, which helps maintain a clean and understandable codebase.
  • Moving imports to function scope is a common best practice to streamline the initial load time of Python modules.
  • This refactor slightly optimizes performance and may reduce memory footprint.
  • The end-users of the library should not observe any direct changes in functionality due to these updates, ensuring backward compatibility. πŸš€

@glenn-jocher glenn-jocher self-assigned this May 12, 2021
@glenn-jocher glenn-jocher added the enhancement New feature or request label May 12, 2021
@glenn-jocher glenn-jocher merged commit 1935266 into master May 12, 2021
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-5 branch May 12, 2021 18:18
Lechtr pushed a commit to Lechtr/yolov5 that referenced this pull request Jul 20, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant