glenn-jocher
commited on
Commit
•
06372b1
1
Parent(s):
1935266
Scope all hubconf.py imports for torch.hub.list() (#3145)
Browse files* Scope all hubconf.py imports for torch.hub.list()
* Update hubconf.py
- hubconf.py +5 -7
hubconf.py
CHANGED
@@ -5,15 +5,8 @@ Usage:
|
|
5 |
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
|
6 |
"""
|
7 |
|
8 |
-
from pathlib import Path
|
9 |
-
|
10 |
import torch
|
11 |
|
12 |
-
from utils.general import check_requirements, set_logging
|
13 |
-
|
14 |
-
dependencies = ['torch', 'yaml']
|
15 |
-
check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('tensorboard', 'pycocotools', 'thop'))
|
16 |
-
|
17 |
|
18 |
def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True):
|
19 |
"""Creates a specified YOLOv5 model
|
@@ -29,11 +22,16 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
|
|
29 |
Returns:
|
30 |
YOLOv5 pytorch model
|
31 |
"""
|
|
|
|
|
32 |
from models.yolo import Model, attempt_load
|
|
|
33 |
from utils.google_utils import attempt_download
|
34 |
from utils.torch_utils import select_device
|
35 |
|
|
|
36 |
set_logging(verbose=verbose)
|
|
|
37 |
fname = Path(name).with_suffix('.pt') # checkpoint filename
|
38 |
try:
|
39 |
if pretrained and channels == 3 and classes == 80:
|
|
|
5 |
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
|
6 |
"""
|
7 |
|
|
|
|
|
8 |
import torch
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True):
|
12 |
"""Creates a specified YOLOv5 model
|
|
|
22 |
Returns:
|
23 |
YOLOv5 pytorch model
|
24 |
"""
|
25 |
+
from pathlib import Path
|
26 |
+
|
27 |
from models.yolo import Model, attempt_load
|
28 |
+
from utils.general import check_requirements, set_logging
|
29 |
from utils.google_utils import attempt_download
|
30 |
from utils.torch_utils import select_device
|
31 |
|
32 |
+
check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('tensorboard', 'pycocotools', 'thop'))
|
33 |
set_logging(verbose=verbose)
|
34 |
+
|
35 |
fname = Path(name).with_suffix('.pt') # checkpoint filename
|
36 |
try:
|
37 |
if pretrained and channels == 3 and classes == 80:
|