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 trained a model of timm-efficientnet-b5 with imagenet pretrained weights on my custom dataset. The train & val process works good. Then when I loaded it back in another script & inferred on a batch of images, it threw out the error AttributeError: 'EfficientNetEncoder' object has no attribute 'act1', as follows. Any idea about this wired issue?
Thank you very much!
/tmp/ipykernel_33/3205381621.py in __iter__(self)
20 # infer with each model
21 for model in self.models:
---> 22 p = model(x)
23 p = torch.sigmoid(p).detach()
24 if py is None:
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1108 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1109 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1110 return forward_call(*input, **kwargs)
1111 # Do not call functions when jit is used
1112 full_backward_hooks, non_full_backward_hooks = [], []
/kaggle/input/segmentation-models-pytorch/segmentation_models.pytorch-0.2.1/segmentation_models_pytorch/base/model.py in forward(self, x)
13 def forward(self, x):
14 """Sequentially pass `x` trough model`s encoder, decoder and heads"""
---> 15 features = self.encoder(x)
16 decoder_output = self.decoder(*features)
17
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1108 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1109 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1110 return forward_call(*input, **kwargs)
1111 # Do not call functions when jit is used
1112 full_backward_hooks, non_full_backward_hooks = [], []
/kaggle/input/segmentation-models-pytorch/segmentation_models.pytorch-0.2.1/segmentation_models_pytorch/encoders/timm_efficientnet.py in forward(self, x)
113
114 def forward(self, x):
--> 115 stages = self.get_stages()
116
117 features = []
/kaggle/input/segmentation-models-pytorch/segmentation_models.pytorch-0.2.1/segmentation_models_pytorch/encoders/timm_efficientnet.py in get_stages(self)
105 return [
106 nn.Identity(),
--> 107 nn.Sequential(self.conv_stem, self.bn1, self.act1),
108 self.blocks[:self._stage_idxs[0]],
109 self.blocks[self._stage_idxs[0]:self._stage_idxs[1]],
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
1184 return modules[name]
1185 raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1186 type(self).__name__, name))
1187
1188 def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:
AttributeError: 'EfficientNetEncoder' object has no attribute 'act1'
The text was updated successfully, but these errors were encountered:
I trained a model of
timm-efficientnet-b5
withimagenet
pretrained weights on my custom dataset. The train & val process works good. Then when I loaded it back in another script & inferred on a batch of images, it threw out the errorAttributeError: 'EfficientNetEncoder' object has no attribute 'act1'
, as follows. Any idea about this wired issue?Thank you very much!
The text was updated successfully, but these errors were encountered: