ValueError: Object should have `state_dict` method.
See original GitHub issuehi,when I train your reid_baseline model ,I met a error that I can’t solve. the error is as follows:
Traceback (most recent call last):
File “/home/lc/Desktop/reid_baseline/tools/train.py”, line 87, in <module>
main()
File “/home/lc/Desktop/reid_baseline/tools/train.py”, line 83, in main
train(cfg)
File “/home/lc/Desktop/reid_baseline/tools/train.py”, line 46, in train
num_query
File “/home/lc/Desktop/reid_baseline/engine/trainer.py”, line 150, in do_train
trainer.run(train_loader, max_epochs=epochs)
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/engine/engine.py”, line 388, in run
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/engine/engine.py”, line 352, in _handle_exception
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/engine/engine.py”, line 379, in run
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/engine/engine.py”, line 287, in _fire_event
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/handlers/checkpoint.py”, line 172, in call
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/handlers/checkpoint.py”, line 130, in _save
File “/usr/local/lib/python3.5/dist-packages/pytorch_ignite-0.2.0-py3.5.egg/ignite/handlers/checkpoint.py”, line 144, in _internal_save
ValueError: Object should have state_dict
method.
How should I fix it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:19
Top GitHub Comments
@yuliuyu your problem is here: https://github.com/L1aoXingyu/reid_baseline/blob/852bb8ae8bd6635527e5a39609f8beed81be26c0/engine/trainer.py#L108-L109
Change it to this and it should be fine:
Thank you for your patient help, I will try it. Thank you angin !