You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered error when running this script: python main_eurosat.py --data_dir data/eurosat --backbone_type pretrain --ckpt_path checkpoints/seco_resnet50_100k.ckpt
Traceback (most recent call last):
File "main_eurosat.py", line 89, in <module>
trainer.fit(model, datamodule=datamodule)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 510, in fit
results = self.accelerator_backend.train()
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 57, in train
return self.train_or_test()
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 74, in train_or_test
results = self.trainer.train()
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 532, in train
self.run_sanity_check(self.get_model())
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 731, in run_sanity_check
_, eval_results = self.run_evaluation(max_batches=self.num_sanity_val_batches)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 643, in run_evaluation
output = self.evaluation_loop.evaluation_step(batch, batch_idx, dataloader_idx)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/evaluation_loop.py", line 171, in evaluation_step
output = self.trainer.accelerator_backend.validation_step(args)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 73, in validation_step
return self._step(self.trainer.model.validation_step, args)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 65, in _step
output = model_step(*args)
File "main_eurosat.py", line 39, in validation_step
loss, acc = self.shared_step(batch)
File "main_eurosat.py", line 46, in shared_step
logits = self(x)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "main_eurosat.py", line 29, in forward
logits = self.classifier(feats)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 93, in forward
return F.linear(input, self.weight, self.bias)
File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/functional.py", line 1690, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: mat1 dim 1 must match mat2 dim 0
The text was updated successfully, but these errors were encountered:
Hi,
I encountered the same issue, which comes from the model initialisation in main_eurosat.py. It is hard-coded for in_features=512, corresponding to the dimension of the feature vector provided by a pre-trained resnet18 encoder. In the case of resnet50, this output vector is of dimension 2048. Hence, you can modify the line 83 from:
model = Classifier(backbone, in_features=512, num_classes=datamodule.num_classes)
to
model = Classifier(backbone, in_features=2048, num_classes=datamodule.num_classes)
I encountered error when running this script:
python main_eurosat.py --data_dir data/eurosat --backbone_type pretrain --ckpt_path checkpoints/seco_resnet50_100k.ckpt
The text was updated successfully, but these errors were encountered: