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

Downloaded pre-trained weights cannot be loaded #13

Open
PeterKKan opened this issue Apr 3, 2024 · 1 comment
Open

Downloaded pre-trained weights cannot be loaded #13

PeterKKan opened this issue Apr 3, 2024 · 1 comment

Comments

@PeterKKan
Copy link

I downloaded weights that you provided from google drive(fold 1 best.pth) and try to use it in train process. here's the back trace.
loading model from best.pth
Traceback (most recent call last):
File "train_and_eval/segmentation_training_transf.py", line 221, in
train_and_evaluate(net, dataloaders, config, device)
File "train_and_eval/segmentation_training_transf.py", line 118, in train_and_evaluate
load_from_checkpoint(net, checkpoint, partial_restore=False)
File "/home/omnisky/kxb/TSVIT/DeepSatModels-main/utils/torch_utils.py", line 34, in load_from_checkpoint
net.load_state_dict(saved_net, strict=True)
File "/home/omnisky/.conda/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for TSViT:
size mismatch for temporal_token: copying a param with shape torch.Size([1, 19, 128]) from checkpoint, the shape in current model is torch.Size([1, 20, 128]).

@michaeltrs
Copy link
Owner

Hi @PeterKKan,

From your error message I understand you are defining 20 output classes. This does not correspond to these pre-trained models which are trained for 19 classes. See the provided config files in https://github.com/michaeltrs/DeepSatModels/tree/main/configs/PASTIS24.

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

2 participants