Loading a pretrained model in PyTorch, error:object not callable
I am trying to load the Efficientnet-b6 weights using PyTorch and Fastai:
PATH = '../input/EffnetB6/efficientnet_b6.pth'
model = torch.load(PATH)

The above model is part of another model:
class EARUnet(nn.Module):
    def __init__(self, pretrained_net, out_ch=1):
        super(EARUnet, self).__init__()
        # print(&quot;EfficientUnet_git_b6_res&quot;)
        self.pretrained_net = pretrained_net
        .
        .
       

When I run:
net = EARUnet(model,1)
learn.fit_flat_cos(10) 

I get this error:
TypeError: 'collections.OrderedDict' object is not callable

What is the model's format requested?

Given the restrained context, I suspect that the problem resides in model, probably containing an OrderedDict of the EfficientNet model state dict, while the EARUnet expects the EfficientNet nn.Module.
You should instead, try something like:
eff_net = EfficientNetB6()
eff_net_state_dict = torch.load(PATH)
eff_net.load_state_dict(eff_net_state_dict)

net = EARUnet(model, 1)

Have a look at this page for more details.
