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

Can't load 'densenet121" #102

Open
carlamao opened this issue Sep 8, 2021 · 1 comment
Open

Can't load 'densenet121" #102

carlamao opened this issue Sep 8, 2021 · 1 comment

Comments

@carlamao
Copy link

carlamao commented Sep 8, 2021

Is the documentation up to date? Because i cant seem to load 'densenet121' using this code, which works for resnet50:

model  = robustness.imagenet_models.resnet50(pretrained=True, num_classes=1000)

When I try to run

model  = robustness.imagenet_models.densenet121(pretrained=True, num_classes=1000)

I get the following error

AttributeError: module 'robustness.imagenet_models' has no attribute 'densenet121'
@Hadisalman
Copy link
Member

Hadisalman commented Nov 10, 2021

@carlamao That's not how you should be loading models in our library. You should instead be doing this

from robustness import model_utils, datasets

ds = datasets.ImageNet(PATH)
model, checkpoint = model_utils.make_and_restore_model(arch='densenet121', dataset=ds)

And this should load densenet121 fine.

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