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

YOLOv5 PyTorch Hub models >> check_requirements() #2577

Merged
merged 2 commits into from
Mar 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update hubconf.py with check_requirements()
Dependency checks have been missing from YOLOv5 PyTorch Hub model loading, causing errors in some cases when users are attempting to import hub models in unsupported environments. This should examine the YOLOv5 requirements.txt file and pip install any missing or version-conflict packages encountered. 

This is highly experimental (!), please let us know if this creates problems in your custom workflows.
  • Loading branch information
glenn-jocher authored Mar 24, 2021
commit 2e3273e4e923f719583e022e89abf6ff8f84ba9c
7 changes: 4 additions & 3 deletions hubconf.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
"""File for accessing YOLOv5 via PyTorch Hub https://pytorch.org/hub/
"""File for accessing YOLOv5 models via PyTorch Hub https://pytorch.org/hub/

Usage:
import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True, channels=3, classes=80)
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
"""

from pathlib import Path

import torch

from models.yolo import Model
from utils.general import set_logging
from utils.general import check_requirements, set_logging
from utils.google_utils import attempt_download
from utils.torch_utils import select_device

dependencies = ['torch', 'yaml']
check_requirements(exclude=('pycocotools', 'thop'))
set_logging()


Expand Down