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

Size mismatch when loading the pretrained pytorch model. #6

Open
xinyusun1997 opened this issue Jun 4, 2020 · 2 comments
Open

Size mismatch when loading the pretrained pytorch model. #6

xinyusun1997 opened this issue Jun 4, 2020 · 2 comments

Comments

@xinyusun1997
Copy link

Below is the error message:
"size mismatch for ref_score_subtract.weight: copying a param with shape torch.Size([1]) from checkpoint, the shape in current model is torch.Size([1, 1])."

Need to manually adjust the size of 'ref_score_subtract.weight'.

@xinyusun1997 xinyusun1997 changed the title Size mismatch when loading pretrained pytorch model. Size mismatch when loading the pretrained pytorch model. Jun 4, 2020
@NagabhushanSN95
Copy link

I was able to fix it as follows

state_dict = torch.load(weights_path, map_location='cpu')
state_dict['ref_score_subtract.weight'] = state_dict['ref_score_subtract.weight'].view((1,1))
self.PieAPP_net.load_state_dict(state_dict)

@shshojaei
Copy link

shshojaei commented Jul 3, 2023

I was able to fix it as follows

state_dict = torch.load(weights_path, map_location='cpu')
state_dict['ref_score_subtract.weight'] = state_dict['ref_score_subtract.weight'].view((1,1))
self.PieAPP_net.load_state_dict(state_dict)

Hi, i have a question if you or @prashnani know, what's the max and min value of pieApp in two reference and generated images? I've got -0.0334 for one of my experiments, is it ok? (i use pyiqa library for calculate pieApp because it's simple to use.)

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