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

RuntimeError: Error(s) in loading state_dict for DetectionModel #2360

Open
shreeramsigdel77 opened this issue Feb 13, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@shreeramsigdel77
Copy link

Error occurred after the completion of training. In this case: after finding the best model error occurred.

Post training:
Graphs and confusion matrix should have been generated but failed. in general cannot run validation (val.py)[Tested: leads to same error]
Another error cannot convert to ONNX with official conversion script

Environment
Include all relevant environment information:

  1. OS [ Ubuntu 22.04 LTS]:
  2. Python version [ 3.10.12]:
  3. SparseML version or commit hash [1.8.0]:
  4. ML framework version(s) [ torch 2.1.2]:
  5. Other Python package versions [ SparseZoo 1.8.1, ]:
  6. Other relevant environment information [ CUDA version 12.2]:

To Reproduce
Trained with custom dataset (rest trained with default parameters)
sparseml.yolov5.train
--cfg yolov5s.yaml
--weights zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned75_quant-none?recipe_type=transfer_learn
--recipe zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned75_quant-none?recipe_type=transfer_learn
--data custom-data.yaml
--patience 20
--hyp hyps/hyp.finetune.yaml

Errors

Its too long so please download from here...
Sample:
yolov5sparse/mysparsevenv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DetectionModel: Missing key(s) in state_dict:

Additional context
While converting the model to ONNX
While running val.py

@shreeramsigdel77 shreeramsigdel77 added the bug Something isn't working label Feb 13, 2025
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

1 participant