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 tried to use the provided pre-trained PTH file presented in the Update section using the following code snippet, but it returns errors of missing keys,
import torch
from networks.resnet_big import SupConResNet
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(f"device to use: {device}")
model = SupConResNet()
model.to(device=device)
model.load_state_dict(torch.load("./supcon.pth", map_location=device))
model.eval()
which results,
Error(s) in loading state_dict for SupConResNet:
Missing key(s) in state_dict: "encoder.conv1.weight", "encoder.bn1.weight", ...
Could you clarify for which model the pre-trained "supcon.pth" is provided?
The text was updated successfully, but these errors were encountered:
@Rasoul77 I solved the serialization by creating the ResNet50 model from the old implementation (https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py), changing the first layer kernel size to 7 and deleting the fully connected part and taking only the projection head. The class that represents the network is SupConResNet.
I tried to use the provided pre-trained PTH file presented in the Update section using the following code snippet, but it returns errors of missing keys,
which results,
Could you clarify for which model the pre-trained "supcon.pth" is provided?
The text was updated successfully, but these errors were encountered: