-
Notifications
You must be signed in to change notification settings - Fork 152
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
No module named 'yolort.utils.update_module_state' while saving the Yolo Model #449
Comments
Hi @HamzaAsiff , This code snippets is now deprecated, and we provide a command-line tool to export yolort-style model files instead python tools/convert_yolov5_to_yolort.py --checkpoint_path {path/to/yolov5s.pt} |
@zhiqwang thanks for the quick reply |
I'm getting the following error: $ python tools/convert_yolov5_to_yolort.py --checkpoint_path yoloBest.pt
Command Line Args: Namespace(checkpoint_path='yoloBest.pt', image_path='zidane.jpg', output_path=None, version='r6.0')
Traceback (most recent call last):
File "tools/convert_yolov5_to_yolort.py", line 42, in <module>
cli_main()
File "tools/convert_yolov5_to_yolort.py", line 38, in cli_main
convert_yolov5_checkpoint(checkpoint_path, output_path, version=args.version)
File "C:\Users\Hamza\anaconda3\envs\FL2\lib\site-packages\yolort\models\_checkpoint.py", line 116, in convert_yolov5_checkpoint
model_info = load_from_ultralytics(checkpoint_path, version=version)
File "C:\Users\Hamza\anaconda3\envs\FL2\lib\site-packages\yolort\models\_checkpoint.py", line 33, in load_from_ultralytics
checkpoint_yolov5 = load_yolov5_model(checkpoint_path)
File "C:\Users\Hamza\anaconda3\envs\FL2\lib\site-packages\yolort\v5\helper.py", line 71, in load_yolov5_model
model = ckpt["ema" if ckpt.get("ema") else "model"].float().eval()
KeyError: 'model' Now I know why I'm getting this error. It's because the program is expecting the pt file in collections.OrderedDict format where model is a key in the dictionary. But what I'm passing is like this: OrderedDict([('model.0.conv.weight',
tensor([[[[ 1.30654e-03, 4.56353e-02, 4.78757e-02, 1.03541e-01, 5.85952e-02, 5.11846e-02],
[ 3.40025e-02, 8.85132e-02, 1.00922e-01, 1.36768e-01, 8.84443e-02, 6.07322e-02],
[ 2.17492e-02, 8.52733e-02, 1.34149e-01, 1.68065e-01, 7.17619e-02, 2.50236e-02],
[ 2.83325e-02, 6.81083e-02, 1.04575e-01, 1.24980e-01, 2.08013e-02, -1.42352e-02],
[-5.29770e-02, -2.78327e-02, -1.52003e-02, -5.02368e-03, -8.73413e-02, -1.14019e-01],
[-9.86468e-02, -9.80953e-02, -1.19396e-01, -8.50665e-02, -1.29254e-01, -1.22292e-01]] What I want to achieve is the following:
I'm getting the above error in the step 4. |
Yep, It seems to crash from following line, and you can customize this part of the code |
I managed to make a fix for this. The yolo train function expects a dictionary which includes: Thanks for the help, closing this issue now. |
Hello,
I followed the conversation and code snippet shared in "Error when convert custom model #90" but when I try to run the code I get the following error:
No module named 'yolort.utils.update_module_state'
Code Snippet:
I installed the latest version of yolort and check the repo but I couldn't find the update_modue_state.py function in the utils directory. Was the file in some previous yolort release?
Code format update by Zhiqiang
The text was updated successfully, but these errors were encountered: