-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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 : Where is the ModelClass ???? #6135
Comments
YOLOv5 save the whole model, not just the weights and biases, see here |
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐! |
Search before asking
Question
Hello, Everyone!!
I have a question, so I'm writing.
In general, there are two cases when loading a trained model in PyTorch.
model = torch.hub.load(~~~, 'custom', path='bset.pt' , source = 'local')
torch.save(model, "./aaa.pt")
yolo_model = torch.load("aaa.pt") ==> This method saves and loads the entire model.
model = torch.hub.load(~~~, 'custom', path='bset.pt' , source = 'local')
torch.save(model.state_dict(), "./aaa.pt")
In the above case, we know that the learned weights are loaded after defining the model class.
In general, PyTorch uses it like this:
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))
How to load state_dict in YOLO???
I wonder where the model class definition is.
I'm curious about loading the model with the load_state_dict method.
Additional
Help me, plz
The text was updated successfully, but these errors were encountered: