Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'EfficientNet' object has no attribute 'delete_blocks' #49

Open
JEILDLWLRMA opened this issue Nov 29, 2023 · 1 comment

Comments

@JEILDLWLRMA
Copy link

Loaded pretrained weights for efficientnet-b0

AttributeError Traceback (most recent call last)
Cell In[19], line 1
----> 1 model = CrossEfficientViT(config=config)
2 model.eval()

Cell In[14], line 267, in CrossEfficientViT.init(self, config)
262 dropout = config['model']['dropout']
263 emb_dropout = config['model']['emb-dropout']
--> 267 self.sm_image_embedder = ImageEmbedder(dim = sm_dim, image_size = image_size, patch_size = sm_patch_size, dropout = emb_dropout, efficient_block = 16, channels=sm_channels)
268 self.lg_image_embedder = ImageEmbedder(dim = lg_dim, image_size = image_size, patch_size = lg_patch_size, dropout = emb_dropout, efficient_block = 1, channels=lg_channels)
270 self.multi_scale_encoder = MultiScaleEncoder(
271 depth = depth,
272 sm_dim = sm_dim,
(...)
289 dropout = dropout
290 )

Cell In[14], line 186, in ImageEmbedder.init(self, dim, image_size, patch_size, dropout, efficient_block, channels)
184 assert image_size % patch_size == 0, 'Image dimensions must be divisible by the patch size.'
185 self.efficient_net = EfficientNet.from_pretrained('efficientnet-b0')
--> 186 self.efficient_net.delete_blocks(efficient_block)
187 self.efficient_block = efficient_block
189 for index, (name, param) in enumerate(self.efficient_net.named_parameters()):

File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1614, in Module.getattr(self, name)
1612 if name in modules:
1613 return modules[name]
-> 1614 raise AttributeError("'{}' object has no attribute '{}'".format(
1615 type(self).name, name))

AttributeError: 'EfficientNet' object has no attribute 'delete_blocks'

@davide-coccomini
Copy link
Owner

Can you check inside the folder cross-efficient-vit/efficient_net/efficientnet_pytorch/model.py if you have the delete_blocks method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants