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

TypeError: __init__() got an unexpected keyword argument 'pretrained' #4

Open
fxle opened this issue Nov 13, 2018 · 2 comments
Open

Comments

@fxle
Copy link

fxle commented Nov 13, 2018

DFL-CNN <==> Part1 : prepare for parameters <==> Begin
DFL-CNN <==> Part1 : prepare for parameters <==> Done
DFL-CNN <==> Part2 : Load Network <==> Begin
Traceback (most recent call last):
File "main.py", line 180, in
main()
File "main.py", line 91, in main
model = DFL_VGG16(k = 10, nclass = 200)
File "/home/steven/Documents/test/DFL-CNN/model/DFL.py", line 13, in init
vgg16featuremap = torchvision.models.vgg16_bn(pretrained=True).features
File "/usr/local/lib/python3.5/dist-packages/torchvision/models/vgg.py", line 130, in vgg16_bn
return VGG(make_layers(cfg['D'], batch_norm=True), **kwargs)
TypeError: init() got an unexpected keyword argument 'pretrained'

Hello dejia
when I reappearance your code this error happened ,Where is the problem?

@fxle fxle closed this as completed Nov 14, 2018
@fxle fxle reopened this Nov 14, 2018
@WangJiuniu
Copy link

Maybe the version of torchvision should be updated.

@Quinniboi10
Copy link

Quinniboi10 commented Jan 22, 2023

https://forums.fast.ai/t/forward-got-an-unexpected-keyword-argument-pretrained/80582

Try this, it worked for me.

import fastai
model = fastai.vision.model.YOURMODELHERE

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

3 participants