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

AttributeError: 'BiSeNet' object has no attribute 'module' #1

Closed
Eileen2014 opened this issue Nov 29, 2018 · 6 comments
Closed

AttributeError: 'BiSeNet' object has no attribute 'module' #1

Eileen2014 opened this issue Nov 29, 2018 · 6 comments

Comments

@Eileen2014
Copy link

load model from ./checkpoints/epoch_295.pth ...
Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\BiSeNet-master\BiSeNet-master\demo.py", line 80, in
main(params)
File "c:\Users\Administrator\Desktop\BiSeNet-master\BiSeNet-master\demo.py", line 60, in main
model.module.load_state_dict(torch.load(args.checkpoint_path))
File "C:\Program Files\Python\lib\site-packages\torch\nn\modules\module.py", line 518, in getattr
type(self).name, name))
AttributeError: 'BiSeNet' object has no attribute 'module'
PS C:\Users\Administrator\Desktop\BiSeNet-master\BiSeNet-master>
Where do I put the dataset ?

@hubutui
Copy link

hubutui commented Dec 1, 2018

Is your gpu available? check https://github.com/ooooverflow/BiSeNet/blob/master/eval.py#L70, after

model = torch.nn.DataParallel(model).cuda()

model need to load state dict by:

model.module.load_state_dict(torch.load(args.checkpoint_path))

Not:

model.load_state_dict(torch.load(args.checkpoint_path))

Maybe a better solution is load state dict before line:

model = torch.nn.DataParallel(model).cuda()

@EchoAmor
Copy link

Have anyone solved this problem???

@zz10001
Copy link

zz10001 commented May 27, 2019

Have anyone solved this problem???

have you sovled it?

@zz10001
Copy link

zz10001 commented May 27, 2019

have you sovled it?

maybe you just delete .module if you just you use one gpu.

@EchoAmor
Copy link

no I didn't . Thanks I'll try @zz10001

@Leeyed
Copy link

Leeyed commented Jan 13, 2021

if your pc have more than one gpu.
Before:
model.to(device)
You should add:
model = nn.DataParallel(model)

BEFORE:
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model.to(device)
AFTER:
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
if torch.cuda.device_count() > 1:
\Space model = nn.DataParallel(model)
model.to(device)

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

6 participants