Skip to content

Commit

Permalink
Fix missing ultralytics package on torch.hub.load()
Browse files Browse the repository at this point in the history
#11945

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
glenn-jocher authored Aug 7, 2023
1 parent 0897415 commit 97bc939
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import inspect
import logging
import logging.config
import math
import os
import platform
import random
Expand All @@ -29,12 +28,23 @@
from zipfile import ZipFile, is_zipfile

import cv2
import math
import numpy as np
import pandas as pd
import pkg_resources as pkg
import torch
import torchvision
import yaml

# Import Ultralytics and install if not found
try:
import ultralytics

assert hasattr(ultralytics, '__version__') # verify package is not directory
except (ImportError, AssertionError):
os.system('pip install -U ultralytics')
import ultralytics

from ultralytics.utils.checks import check_requirements

from utils import TryExcept, emojis
Expand Down Expand Up @@ -416,7 +426,7 @@ def check_imshow(warn=False):
return False


def check_suffix(file='yolov5s.pt', suffix=('.pt', ), msg=''):
def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
# Check file(s) for acceptable suffix
if file and suffix:
if isinstance(suffix, str):
Expand Down

0 comments on commit 97bc939

Please sign in to comment.