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

'function' object has no attribute 'parameters' when I start to train the backbone in the 10 epoch #283

Closed
zy5037 opened this issue Jan 18, 2020 · 6 comments
Assignees
Labels

Comments

@zy5037
Copy link

zy5037 commented Jan 18, 2020

start training backbone.
Traceback (most recent call last):
File "../../tools/train.py", line 322, in
main()
File "../../tools/train.py", line 317, in main
train(train_loader, dist_model, optimizer, lr_scheduler, tb_writer)
File "../../tools/train.py", line 194, in train
optimizer, lr_scheduler = build_opt_lr(model.module, epoch)
File "../../tools/train.py", line 77, in build_opt_lr
for param in getattr(model.backbone, layer).parameters():
AttributeError: 'function' object has no attribute 'parameters'

How can I deal with it?

@ZhiyuanChen ZhiyuanChen self-assigned this Jan 18, 2020
@ZhiyuanChen
Copy link
Collaborator

What backbone are you using?

@zy5037
Copy link
Author

zy5037 commented May 21, 2020 via email

@ZhiyuanChen
Copy link
Collaborator

resnet50 At 2020-05-14 17:24:59, "Zhiyuan Chen" [email protected] wrote: What backbone are you using? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Sorry for this extremely late reply. getattr(model.backbone, layer) should have returned a backbone (nn.module) object, but what you got is a function.

@shlsp
Copy link

shlsp commented Mar 24, 2021

I have encountered the same problem. Could you please tell me the specific solution?

@ZhiyuanChen
Copy link
Collaborator

I have encountered the same problem. Could you please tell me the specific solution?

Can you try getattr(model.backbone, layer)()instead?

@shlsp
Copy link

shlsp commented Mar 24, 2021

Thank you very much for your answer, I have solved this problem.

ZhiyuanChen added a commit that referenced this issue Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants