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

torchhub load model python version restriction #3543

Closed
LIU-FAYANG opened this issue Jun 9, 2021 · 6 comments · Fixed by #3547 or #3548
Closed

torchhub load model python version restriction #3543

LIU-FAYANG opened this issue Jun 9, 2021 · 6 comments · Fixed by #3547 or #3548
Labels
question Further information is requested

Comments

@LIU-FAYANG
Copy link

❔Question

Hi, it looks similar to the model loading opencv-python problem, could you help cancel the pytorchhub python version check?
Also, can I ask what's the right way to load the model locally, thanks a lot!

Additional context

Traceback (most recent call last):
File "loitering_main.py", line 373, in
main()
File "loitering_main.py", line 120, in main
detector = torch.hub.load('ultralytics/yolov5', 'yolov5s',force_reload= True)
File "/home/psl/.local/lib/python3.6/site-packages/torch/hub.py", line 370, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "/home/psl/.local/lib/python3.6/site-packages/torch/hub.py", line 399, in _load_local
model = entry(*args, **kwargs)
File "/home/psl/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 70, in yolov5s
return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)
File "/home/psl/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 34, in _create
exclude=('tensorboard', 'pycocotools', 'thop', 'opencv-python'))
File "/home/psl/.cache/torch/hub/ultralytics_yolov5_master/utils/general.py", line 151, in check_requirements
check_python() # check python version
File "/home/psl/.cache/torch/hub/ultralytics_yolov5_master/utils/general.py", line 144, in check_python
assert result, f'Python {minimum} required by YOLOv5, but Python {current} is currently installed'
AssertionError: Python 3.7.0 required by YOLOv5, but Python 3.6.9 is currently installed

@LIU-FAYANG LIU-FAYANG added the question Further information is requested label Jun 9, 2021
@glenn-jocher
Copy link
Member

@LIU-FAYANG unfortunately 3.6.9 doesn't pass CI checks currently. It looks like the cause is inability to install pycocotools>2.0 with python 3.6.9. I'll think about how to work around this!
https://github.com/ultralytics/yolov5/pull/3375/checks?check_run_id=2782033417

@glenn-jocher
Copy link
Member

@LIU-FAYANG I think the best approach would be to comment pycocotools in requirements.txt and insert a special check_requirements call in test.py right before pycocotools is imported. I think 3.6.9 might pass CI after these updates. I will try to implement these changes today.

TODO: install pycocotools on-demand only.

@glenn-jocher glenn-jocher added the TODO High priority items label Jun 9, 2021
@glenn-jocher glenn-jocher linked a pull request Jun 9, 2021 that will close this issue
@glenn-jocher
Copy link
Member

@LIU-FAYANG I've updated pycocotools handling in #3547, and merged updated master into #3375, which is now running CI tests on all python versions. If the 3.6.9 tests pass, I will create a new PR to reduce the YOLOv5 python requirement to 3.6.9, and then this issue should be resolved.

@glenn-jocher glenn-jocher reopened this Jun 9, 2021
@glenn-jocher glenn-jocher linked a pull request Jun 9, 2021 that will close this issue
@glenn-jocher
Copy link
Member

glenn-jocher commented Jun 9, 2021

@LIU-FAYANG good news 😃! Your original issue may now be fixed ✅ in PRs #3547 and #3548. Python minimum version reduced to 3.6.2. To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload with model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@glenn-jocher glenn-jocher removed the TODO High priority items label Jun 9, 2021
@LIU-FAYANG
Copy link
Author

@glenn-jocher Hi, it works now, thanks for your kind help! :)

@glenn-jocher
Copy link
Member

@LIU-FAYANG great, glad to hear it! Let us know if you run into any other problems :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
2 participants