If the dict returned by torch.load('file.pth') has two keys (you mention model and opt), you have to extract the value of the key model and then pass it to the model’s load_state_dict like that:
model = torchvision.models.resnet34()
state_dict = torch.load('file.pth')
model.load_state_dict(state_dict['model'])

Alternatively, you can pass the whole state_dict to load_state_dict and set the flag strict to False:
model.load_state_dict(state_dict['model'], strict=False)

It should work unless the structures of the models differ (the saved model is not an instance of resnet).