Scope all hubconf.py imports for torch.hub.list()
diff --git a/hubconf.py b/hubconf.py
index 1876441d8a8..3b3dfe0e9e2 100644
--- a/hubconf.py
+++ b/hubconf.py
@@ -5,15 +5,8 @@
     model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
 """
 
-from pathlib import Path
-
 import torch
 
-from utils.general import check_requirements, set_logging
-
-dependencies = ['torch', 'yaml']
-check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('tensorboard', 'pycocotools', 'thop'))
-
 
 def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True):
     """Creates a specified YOLOv5 model
@@ -29,11 +22,16 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
     Returns:
         YOLOv5 pytorch model
     """
+    from pathlib import Path
+
     from models.yolo import Model, attempt_load
+    from utils.general import check_requirements, set_logging
     from utils.google_utils import attempt_download
     from utils.torch_utils import select_device
 
+    check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('tensorboard', 'pycocotools', 'thop'))
     set_logging(verbose=verbose)
+
     fname = Path(name).with_suffix('.pt')  # checkpoint filename
     try:
         if pretrained and channels == 3 and classes == 80:



## 🛠️ PR Summary

<sub>Made with ❤️ by [Ultralytics Actions](https://github.com/ultralytics/actions)<sub>

### 🌟 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.