EfficientNet-PyTorch icon indicating copy to clipboard operation
EfficientNet-PyTorch copied to clipboard

KeyError: 'efficientnet-b8'

Open ViktorBystrov72 opened this issue 4 years ago • 2 comments

Hello!

When I tried:

model_name = 'efficientnet-b8'
print(EfficientNet.get_image_size(model_name))
Output: 672

Then

model = EfficientNet.from_pretrained(model_name)

I got error:

Traceback (most recent call last): File "myfile.py", line 526, in model = EfficientNet.from_pretrained(model_name) File "myfolder/venv/lib64/python3.6/site-packages/efficientnet_pytorch/model.py", line 375, in from_pretrained load_pretrained_weights(model, model_name, weights_path=weights_path, load_fc=(num_classes == 1000), advprop=advprop) File "myfolder/venv/lib64/python3.6/site-packages/efficientnet_pytorch/utils.py", line 597, in load_pretrained_weights state_dict = model_zoo.load_url(url_map_[model_name]) KeyError: 'efficientnet-b8'

Can you help me pleas?

ViktorBystrov72 avatar Apr 21 '21 10:04 ViktorBystrov72

Pretrained model names for this package in model zoo are efficientnet-b0 to efficientnet-b7.

mfalfafa avatar Jun 18 '21 14:06 mfalfafa

Hello!

When I tried:

model_name = 'efficientnet-b8'
print(EfficientNet.get_image_size(model_name))
Output: 672

Then

model = EfficientNet.from_pretrained(model_name)

I got error:

Traceback (most recent call last): File "myfile.py", line 526, in model = EfficientNet.from_pretrained(model_name) File "myfolder/venv/lib64/python3.6/site-packages/efficientnet_pytorch/model.py", line 375, in from_pretrained load_pretrained_weights(model, model_name, weights_path=weights_path, load_fc=(num_classes == 1000), advprop=advprop) File "myfolder/venv/lib64/python3.6/site-packages/efficientnet_pytorch/utils.py", line 597, in load_pretrained_weights state_dict = model_zoo.load_url(url_map_[model_name]) KeyError: 'efficientnet-b8'

Can you help me pleas?

You can use b8 version pretrained weights only from advprop trained version, so:

model = EfficientNet.from_pretrained(model_name, adv_prop = True)

Ant-Bru avatar Sep 23 '21 20:09 Ant-Bru