1

I followed this tutorial to build ANPR with YoloV5 and EasyOCR. After I trained my model I wanted to load it using torch, using this code snippet:

import torch

yolo = torch.hub.load(
    'ultralytics/yolov5',
    'custom',
    path='/content/yolov5/runs/train/yolov5s_results/weights/best.pt',
    force_reload=True)

but I face this error:

ImportError: cannot import name 'is_jupyter' from 'utils.general' (/content/yolov5/utils/general.py)

I really appreciate any help you can provide.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Ahmed Adel
  • 49
  • 6

1 Answers1

0

Hmm weird, is_jupyter should exist according to this. You could try git pull again maybe, or delete the repo and completely re-clone the whole thing from scratch? I've experienced some git shenanigans in the automatic1111 stable diffusion webgui, it would update some things and keep other things the same whenever I pulled. Deleting the repo then re-cloning solved it for me as far as missing stuff. Maybe just copy the contents of general.py on the repo? If that doesn't do the trick, I'd do as @ChristophRackwitz recommends and report the issue.

Also if this is useful info, they changed the function from is_notebook to is_jupyter in February, not too long ago. If you've had yolov5 for more than that amount of time, I really think deleting your repo then starting from scratch will almost definitely fix it. Check out your general.py, I think it will still have the is_notebook function.

Brock Brown
  • 956
  • 5
  • 11