slwang9353 / MobileFormer

MobileFormer in torch
66 stars 13 forks source link

NameError: name 'Mixup' is not defined #2

Open fire717 opened 3 years ago

slwang9353 commented 3 years ago

Mixup is defined in extend.py, I forgot to update the train.py, sorry for that! You can add 'from extend import * ' in the train.py, or or just use the updated version. Thanks for your issue.

fire717 commented 3 years ago

Thx! I've add it and now get stuck here ` ############################### Training test ###############################

Device: cuda

############################### Dataset loading ############################### Files already downloaded and verified Files already downloaded and verified ############################### Dataset loaded ##############################

runing under lr: 0.0027452036817180113 , wd: 0.00716511533623753 for 2 epochs. ############################# Training... ############################# F:\Software\Anaconda\envs\pth\lib\site-packages\torch\functional.py:327: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:918.) return _VF.einsum(equation, operands) F:\Workshop\CV\MobileFormer-main\model.py:221: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output channels_last tensor even if some of the inputs are not in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:924.) return feature + res [W ..\aten\src\ATen\native\TensorIterator.cpp:918] Warning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (function operator ()) `

slwang9353 commented 3 years ago

Thx! I've add it and now get stuck here ` ############################### Training test ###############################

Device: cuda

############################### Dataset loading ############################### Files already downloaded and verified Files already downloaded and verified ############################### Dataset loaded ##############################

runing under lr: 0.0027452036817180113 , wd: 0.00716511533623753 for 2 epochs. ############################# Training... ############################# F:\Software\Anaconda\envs\pth\lib\site-packages\torch\functional.py:327: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:918.) return _VF.einsum(equation, operands) F:\Workshop\CV\MobileFormer-main\model.py:221: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output channels_last tensor even if some of the inputs are not in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:924.) return feature + res [W ..\aten\src\ATen\native\TensorIterator.cpp:918] Warning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (function operator ()) `

Thx! I've add it and now get stuck here ` ############################### Training test ###############################

Device: cuda

############################### Dataset loading ############################### Files already downloaded and verified Files already downloaded and verified ############################### Dataset loaded ##############################

runing under lr: 0.0027452036817180113 , wd: 0.00716511533623753 for 2 epochs. ############################# Training... ############################# F:\Software\Anaconda\envs\pth\lib\site-packages\torch\functional.py:327: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:918.) return _VF.einsum(equation, operands) F:\Workshop\CV\MobileFormer-main\model.py:221: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output channels_last tensor even if some of the inputs are not in channels_last format. (Triggered internally at ..\aten\src\ATen\native\TensorIterator.cpp:924.) return feature + res [W ..\aten\src\ATen\native\TensorIterator.cpp:918] Warning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (function operator ()) `

I guess it is a format issue caused by .permute( ) in line 216, where i permute( ) image format (N, C, H*W ) to token format (N, L, D). Try add .contiguous( ) after every .permute( ) in Python 1.6, or maybe update to Python 1.7 (I'm using 1.7 and I have not encountered this issue).

slwang9353 commented 3 years ago

And use the last version of the model.py by the way.

fire717 commented 3 years ago

OK I'll try it later