-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
How to load model with load_state_dict ? #18097
Comments
👋 Hello @aymuos15, thank you for your interest in Ultralytics 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a ❓ Question, please provide as much information as possible, including a detailed explanation of your use case and full error logs, as well as verifying compatibility with the latest For this specific inquiry regarding model loading using
Feel free to share exact error messages or provide details about how these layers mismatch to help us gain further insight into the issue. An Ultralytics engineer will also assist you soon to provide more guidance 🙂. Join the Ultralytics community where it suits you best. For real-time chat, head to Discord 🎧. Prefer in-depth discussions? Check out Discourse. Or dive into threads on our Subreddit to share knowledge with the community. UpgradeUpgrade to the latest pip install -U ultralytics EnvironmentsYOLO may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all Ultralytics CI tests are currently passing. CI tests verify the correct operation of all YOLO Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
Even this throws the same error |
@aymuos15 it seems the weight file might not completely match the model architecture. Instead, consider using the |
Simply changing |
Thanks a lot for the suggestions. Could you please answer the following question: when I run: but not when I run: It is the exact same weights file. |
Does your yaml's nc match with the weights? |
This fixed my error. Thanks a lot!
I double checked now! |
You're welcome! Glad it worked for you. Let us know if you have any further questions or run into any issues. Happy experimenting with YOLO! |
Search before asking
Question
This works fine! But I am in a situation where I can not use this.
My alternative which I found: ultralytics/yolov5#1441 (comment)
But this does not work. few layers throw mismatch error:
How do I go about this?
Additional
No response
The text was updated successfully, but these errors were encountered: