Hey, I am currently trying to use a model I trained with FastAI ( Colab: Google Colaboratory 1) on Pytorch. Here are the steps I use on pytorch side:
//Create the instance of ResNET34 model, if I don’t use the num_classes = 2 overload, I end up with incompatible size error on output layer of the neural network (By default ResNET model has 1000 on Fc layer even though my trained model is trained on fc layer with size 2?).
model = torchvision.models.resnet34(pretrained=False, num_classes = 2)
model_dict = model.state_dict()
loc =  torch.load(“models/stage-2.pth”, map_location=“cpu”)[‘model’]
model.load_state_dict(
    loc, strict=False
)

transform = torchvision.transforms.ToTensor()
image = transform(image).unsqueeze(0)
result = model(image)
However, my results make no sense. Sometimes it shows an output like:
tensor([[ 3.6697, -6.6085]], grad_fn=)
And when I rerun I end up with something like;
dim=tensor([[ 2.4605, -5.6492]], grad_fn=)
Can anyone lead me on which step I’m missing? Thanks!