jrzaurin / pytorch-widedeep

A flexible package for multimodal-deep-learning to combine tabular data with text and images using Wide and Deep models in Pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytorch vision module error

TheLegendAli opened this issue · comments

commented

when I try to import from the vision library using:

from pytorch_widedeep.models import Vision
Vision(pretrained_model_name="resnet")

I get the following error:

`----> 2 Vision(pretrained_model_name="resnet")

File ~/Library/Python/3.9/lib/python/site-packages/pytorch_widedeep/utils/general_utils.py:61, in Alias.call(self, wrapped, instance, args, kwargs)
57 else:
58 set_default_attr(wrapped, "__wd_aliases_used", {})[
59 self.primary_name
60 ] = alias
---> 61 return wrapped(*args, **kwargs)

File ~/Library/Python/3.9/lib/python/site-packages/pytorch_widedeep/models/image/vision.py:156, in Vision.init(self, pretrained_model_setup, n_trainable, trainable_params, channel_sizes, kernel_sizes, strides, head_hidden_dims, head_activation, head_dropout, head_batchnorm, head_batchnorm_last, head_linear_first)
153 self.head_batchnorm_last = head_batchnorm_last
154 self.head_linear_first = head_linear_first
--> 156 self.features, self.backbone_output_dim = self._get_features()
158 if pretrained_model_setup is not None:
159 self._freeze(self.features)

File ~/Library/Python/3.9/lib/python/site-packages/pytorch_widedeep/models/image/vision.py:201, in Vision._get_features(self)
199 if isinstance(self.pretrained_model_setup, str):
200 try:
--> 201 pretrained_model = torchvision.models.dict
202 self.pretrained_model_setup
203

204 except ValueError:
205 pretrained_model = torchvision.models.dict
206 self.pretrained_model_setup
207

TypeError: 'module' object is not callable`

commented

@TheLegendAli

Issue fixed by PR #171