BR-IDL / PaddleViT

:robot: PaddleViT: State-of-the-art Visual Transformer and MLP Models for PaddlePaddle 2.0+
https://github.com/BR-IDL/PaddleViT
Apache License 2.0
1.22k stars 318 forks source link

small issue #116

Closed ky0107 closed 2 years ago

ky0107 commented 2 years ago

Describe the bug resume training error AttributeError: 'Momentum' object has no attribute 'set_dict'

To Reproduce Steps to reproduce the behavior: 1.Go to 'PaddleViT/object_detection/Swin/' 2.Run 'python main_single_gpu.py -resume='./output/train-20211210-09-50-43/Swin-Epoch-45'

The recovery of model can pass

Screenshots Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "F:/***/pp_swin/main_single_gpu.py", line 400, in <module> main() File "F:/***/pp_swin/main_single_gpu.py", line 313, in main optimizer.set_dict(opt_state) AttributeError: 'Momentum' object has no attribute 'set_dict'

Version (please complete the following information):

xperzy commented 2 years ago

Thanks for the issue. Currently, training for the Swin Detection is still in progress, which may have other issues rather than this one. So I would suggest not using Swin Object detection training now. We will try to fix as soon as possible.

xperzy commented 2 years ago

@FL77N Could you help evaluate the workload and check out our plan for the swin object detection ?

FL77N commented 2 years ago

Describe the bug resume training error AttributeError: 'Momentum' object has no attribute 'set_dict'

To Reproduce Steps to reproduce the behavior: 1.Go to 'PaddleViT/object_detection/Swin/' 2.Run 'python main_single_gpu.py -resume='./output/train-20211210-09-50-43/Swin-Epoch-45'

The recovery of model can pass

Screenshots Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "F:/***/pp_swin/main_single_gpu.py", line 400, in <module> main() File "F:/***/pp_swin/main_single_gpu.py", line 313, in main optimizer.set_dict(opt_state) AttributeError: 'Momentum' object has no attribute 'set_dict'

Version (please complete the following information):

  • Paddle Version: [ 2.2.0]
  • Python Version [3.6]
  • GPU/CPU mode [ Gpu]

Hello! "main_single_gpu.py line 313" try to change optimizer.set_dict(opt_state) to optimizer.set_state_dict(opt_state)

ky0107 commented 2 years ago

Describe the bug resume training error AttributeError: 'Momentum' object has no attribute 'set_dict' To Reproduce Steps to reproduce the behavior: 1.Go to 'PaddleViT/object_detection/Swin/' 2.Run 'python main_single_gpu.py -resume='./output/train-20211210-09-50-43/Swin-Epoch-45' The recovery of model can pass Screenshots Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "F:/***/pp_swin/main_single_gpu.py", line 400, in <module> main() File "F:/***/pp_swin/main_single_gpu.py", line 313, in main optimizer.set_dict(opt_state) AttributeError: 'Momentum' object has no attribute 'set_dict' Version (please complete the following information):

  • Paddle Version: [ 2.2.0]
  • Python Version [3.6]
  • GPU/CPU mode [ Gpu]

Hello! "main_single_gpu.py line 313" try to change optimizer.set_dict(opt_state) to optimizer.set_state_dict(opt_state)

Thank you for your answer and successfully solved the problem.

xperzy commented 2 years ago

I have change the related code. Since this issue has been fixed, I close this issue.