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

Failed to load the checkpoint after completion of model training in Google Colab #15

Open
abirsince92 opened this issue Feb 8, 2023 · 0 comments

Comments

@abirsince92
Copy link

abirsince92 commented Feb 8, 2023

Respected Sir,
The code is fine!!! but when I write the in Colab by training using pruned and quantized YoloV5s version.
Kindly solve this issue pls.

!cd yolov5-deepsparse-blogpost/yolov5-train/ && python train.py
--cfg ./models_v5.0/yolov5s.yaml
--recipe ../recipes/yolov5s.pruned_quantized.md
--data hand_gesture.yaml --hyp data/hyps/hyp.scratch.yaml
--weights yolov5s.pt --img 640 --batch-size 32 --epochs 30 --optimizer Adam

61 epochs completed in 3.229 hours.
Optimizer stripped from runs/train/exp2/weights/last.pt, 14.6MB
Optimizer stripped from runs/train/exp2/weights/best.pt, 14.6MB

Validating runs/train/exp2/weights/best.pt...
Fusing layers...
YOLOv5s summary: 224 layers, 7091668 parameters, 0 gradients, 16.4 GFLOPs
2023-02-07 19:12:35 sparseml.optim.manager INFO Created recipe manager with metadata: {
"metadata": null
}
Created recipe manager with metadata: {
"metadata": null
}
Traceback (most recent call last):
File "train.py", line 745, in
main(opt)
File "train.py", line 641, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 514, in train
model=load_checkpoint(type_='ensemble', weights=best, device=device)[0],
File "/content/yolov5-deepsparse-blogpost/yolov5-train/export.py", line 529, in load_checkpoint
state_dict = load_state_dict(model, state_dict, run_mode=not ensemble_type, exclude_anchors=exclude_anchors)
File "/content/yolov5-deepsparse-blogpost/yolov5-train/export.py", line 553, in load_state_dict
model.load_state_dict(state_dict, strict=not run_mode) # load
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Model:
Missing key(s) in state_dict: "model.0.conv.conv.quant.activation_post_process.scale", "model.0.conv.conv.quant.activation_post_process.zero_point", "model.0.conv.conv.quant.activation_post_process.fake_quant_enabled", "model.0.conv.conv.quant.activation_post_process.observer_enabled", "model.0.conv.conv.quant.activation_post_process.scale", "model.0.conv.conv.quant.activation_post_process.zero_point",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant