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
Hello. I've been using your model weights and it was all working fine a couple years ago. I was trying today and I was getting weird results and I noticed that your model's state_dict has weights for layers 'fc.1.bias', 'fc.1.weight', 'fc.3.bias', 'fc.3.weight' while the resnet definition I am using today as of 2024 contains only 'fc.bias', 'fc.weight'. I am assuming this is why it wasn't working.
While I can override and create those last fc layers, I was wondering if there is any "fc2" that existed before? I wonder if it would have been possible to put here the definition of the model, since pytorch themselves may and indeed seem to have changed the definition of the model.
model = torchvision.models.__dict__['resnet18'](pretrained=False)
model_dict = model.state_dict()
model_dict["fc.weight"].shape
> torch.Size([1000, 512])
MODEL_PATH = "pretrained_models/tenpercent_resnet18.ckpt"
state = torch.load(MODEL_PATH, map_location='cuda:0')
state_dict = state['state_dict']
for k in ['fc.1.weight', 'fc.1.bias', 'fc.3.weight', 'fc.3.bias']:
print(state_dict[k].shape)
> torch.Size([512, 512])
> torch.Size([512])
> torch.Size([128, 512])
> torch.Size([128])
torchvision.__version__
> '0.8.2'
torch.__version__
> '1.7.1'
sys.version
> '3.6.10 | packaged by conda-forge | (default, Apr 24 2020, 16:44:11) \n[GCC 7.3.0]'
The text was updated successfully, but these errors were encountered:
Hello. I've been using your model weights and it was all working fine a couple years ago. I was trying today and I was getting weird results and I noticed that your model's state_dict has weights for layers
'fc.1.bias', 'fc.1.weight', 'fc.3.bias', 'fc.3.weight'
while the resnet definition I am using today as of 2024 contains only'fc.bias', 'fc.weight'
. I am assuming this is why it wasn't working.While I can override and create those last fc layers, I was wondering if there is any "fc2" that existed before? I wonder if it would have been possible to put here the definition of the model, since pytorch themselves may and indeed seem to have changed the definition of the model.
The text was updated successfully, but these errors were encountered: