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: mat1 and mat2 shapes cannot be multiplied (6144x1456 and 2720x85) #24

Open
smallzhu opened this issue Jun 30, 2022 · 4 comments

Comments

@smallzhu
Copy link

smallzhu commented Jun 30, 2022

When I select efficentnet for training I get the following error, only swin-transformer does not report it
Can you help me?

Start Training 1 EpochTraceback (most recent call last):
File "D:/hxy/FGVC-PIM-master/main.py", line 301, in
main(args, tlogger)
File "D:/hxy/FGVC-PIM-master/main.py", line 253, in main
train(args, epoch, model, scaler, amp_context, optimizer, schedule, train_loader)
File "D:/hxy/FGVC-PIM-master/main.py", line 140, in train
outs = model(datas)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\data_parallel.py", line 168, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\data_parallel.py", line 178, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch_utils.py", line 457, in reraise
raise exception
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "D:\hxy\FGVC-PIM-master\models\pim_module\pim_module.py", line 414, in forward
comb_outs = self.combiner(selects)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "D:\hxy\FGVC-PIM-master\models\pim_module\pim_module.py", line 81, in forward
hs = self.param_pool0(hs)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\mj\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\linear.py", line 103, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (6144x1456 and 2720x85)

@chou141253
Copy link
Owner

How is your config file set?

@smallzhu
Copy link
Author

smallzhu commented Jul 5, 2022

How is your config file set?

project_name: tea_swin_t
exp_name: T3000
use_wandb: True
wandb_entity: dechenzhu
train_root: D:\hxy\FGVC-PIM-master\dataset\data3
val_root: D:\hxy\FGVC-PIM-master\dataset\test1
data_size: 448
num_workers: 2
batch_size: 8
model_name: efficient
pretrained: ~
optimizer: SGD
max_lr: 0.0005
wdecay: 0.0005
max_epochs: 300
warmup_batchs: 800
use_amp: True
use_fpn: True
fpn_size: 1536
use_selection: True
num_classes: 25
num_selects:
layer1: 2048
layer2: 512
layer3: 128
layer4: 32
use_combiner: False
lambda_b: 0.5
lambda_s: 0.0
lambda_n: 5.0
lambda_c: 1.0
update_freq: 2
log_freq: 100
eval_freq: 2

@Chaoran-F
Copy link

same question in here, backbone is EfficientNet

@Chaoran-F
Copy link

How is your config file set?

project_name: tea_swin_t exp_name: T3000 use_wandb: True wandb_entity: dechenzhu train_root: D:\hxy\FGVC-PIM-master\dataset\data3 val_root: D:\hxy\FGVC-PIM-master\dataset\test1 data_size: 448 num_workers: 2 batch_size: 8 model_name: efficient pretrained: ~ optimizer: SGD max_lr: 0.0005 wdecay: 0.0005 max_epochs: 300 warmup_batchs: 800 use_amp: True use_fpn: True fpn_size: 1536 use_selection: True num_classes: 25 num_selects: layer1: 2048 layer2: 512 layer3: 128 layer4: 32 use_combiner: False lambda_b: 0.5 lambda_s: 0.0 lambda_n: 5.0 lambda_c: 1.0 update_freq: 2 log_freq: 100 eval_freq: 2

did you solve this issue

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

3 participants