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

Loading custom model does not work #11553

Closed
1 of 2 tasks
zkytony opened this issue May 19, 2023 · 4 comments
Closed
1 of 2 tasks

Loading custom model does not work #11553

zkytony opened this issue May 19, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@zkytony
Copy link

zkytony commented May 19, 2023

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

No response

Bug

Previously, I can load a custom pretrained model like this:

torch.hub.load('ultralytics/yolov5', 'custom', path='path/to/model.pt')

However, after some recent developments (see issues below for related problems that occur after those developments).

Exception: [Errno 20] Not a directory: 'path/to/model.py'. Cache may be out o
f date, try `force_reload=True` or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_mode
l_loading for help.

I followed the suggestion and add force_reload=True:

torch.hub.load('ultralytics/yolov5', 'custom', path='path/to/model.pt', force_reload=True)

I am getting the SAME error:

Exception: [Errno 20] Not a directory: 'path/to/model.py'. Cache may be out of date, try `force_reload=True` or see https://docs.ultralytics.com
/yolov5/tutorials/pytorch_hub_model_loading for help.

What is going on with yolov5?

Environment

  • YOLOv5
  • ubuntu 22.04
  • python 3.10.6
  • torch 1.13.1+cu17

Minimal Reproducible Example

torch.hub.load('ultralytics/yolov5', 'custom', path='path/to/model.pt')

Choose a model path to replace 'path/to/model.pt'

Additional

No

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@zkytony zkytony added the bug Something isn't working label May 19, 2023
@zkytony
Copy link
Author

zkytony commented May 19, 2023

Never mind. My path was wrong and I didn't realize it sorry:(

This may be helpful to others who run into a similar situation.

@zkytony zkytony closed this as completed May 19, 2023
@glenn-jocher
Copy link
Member

@zkytony no worries at all! It's great to hear that you were able to solve the issue. Don't hesitate to reach out if you have any further questions or concerns. Thank you for your support and happy coding!

@developerlaborotory
Copy link

I just had to reset my pc xD

@glenn-jocher
Copy link
Member

@developerlaborotory not a problem at all! Sometimes a reset can help with unforeseen issues. If you have any further questions or run into any other problems, feel free to ask. Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants