Using:

#load
pretrained_dict  = torch.load(‘H:/workspace/pretrain/epoch_500_pretrain_resnet50.pth’)
model_dict = model.state_dict()
# 1. filter out unnecessary keys
pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
# 3. load the new state dict
model.load_state_dict(model_dict)
# copy braches 0 -> branches 1/2
model.branches[1].weight.copy_(model.branches[0].weight)

I get an error: AttributeError: ‘Sequential’ object has no attribute ‘weight’
Im not sure whats wrong?
Here is an image of the model structure that might reveal the issue?

image499×584 24 KB