lukemelas / EfficientNet-PyTorch

A PyTorch implementation of EfficientNet
Apache License 2.0
7.86k stars 1.52k forks source link

KeyError: 'efficientnet-b8' #281

Open ViktorGlushak opened 3 years ago

ViktorGlushak commented 3 years ago

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(urlmap[model_name]) KeyError: 'efficientnet-b8'

Can you help me pleas?

mfalfafa commented 3 years ago

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

Ant-Bru commented 2 years ago

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(urlmap[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)