Open
Description
Python 3.8.7
efficientnet-pytorch==0.7.1
There's an issue loading the pre-trained weights (or any saved weights) when using include_top = False
from efficientnet_pytorch import EfficientNet
model = EfficientNet.from_pretrained('efficientnet-b0', include_top = False)
Traceback (most recent call last):
File "test_file.py", line 2, in <module>
model = EfficientNet.from_pretrained('efficientnet-b0', include_top = False)
File "/Users/constantinbaumgartner/Desktop/temp_test/test/lib/python3.8/site-packages/efficientnet_pytorch/model.py", line 378, in from_pretrained
load_pretrained_weights(model, model_name, weights_path=weights_path,
File "/Users/constantinbaumgartner/Desktop/temp_test/test/lib/python3.8/site-packages/efficientnet_pytorch/utils.py", line 613, in load_pretrained_weights
assert not ret.unexpected_keys, 'Missing keys when loading pretrained weights: {}'.format(ret.unexpected_keys)
AssertionError: Missing keys when loading pretrained weights: ['_fc.weight', '_fc.bias']
It seems to be related to the latest release 0.7.1
because the issue doesn't present when using the previous version: efficientnet-pytorch==0.7.0
from efficientnet_pytorch import EfficientNet
model = EfficientNet.from_pretrained('efficientnet-b0', include_top = False)
Loaded pretrained weights for efficientnet-b0
Metadata
Metadata
Assignees
Labels
No labels