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: cuda() got an unexpected keyword argument 'device_id' #6

Closed
zxt-triumph opened this issue Oct 18, 2018 · 4 comments
Closed

Comments

@zxt-triumph
Copy link

zxt-triumph commented Oct 18, 2018

I encountered a problem while training.
Traceback (most recent call last):
File "train.py", line 13, in
model = create_model(opt)
File "/home/zxt/GAN Network/PS-GAN/models/models.py", line 19, in create_model
model.initialize(opt)
File "/home/zxt/GAN Network/PS-GAN/models/pix2pix_model.py", line 36, in initialize
opt.which_model_netG, opt.norm, not opt.no_dropout, self.gpu_ids)
File "/home/zxt/GAN Network/PS-GAN/models/networks.py", line 51, in define_G
netG.cuda(device_id=gpu_ids[0])
TypeError: cuda() got an unexpected keyword argument 'device_id'
How to solve this problem? Looking forward to your reply.

@yifanjiang19
Copy link
Owner

It’s due to the pytorch version. Just replace ‘device_id’ with ‘divice’.

@zxt-triumph
Copy link
Author

Thank you for your reply! But I meet new problem.
Traceback (most recent call last):
File "train.py", line 13, in
model = create_model(opt)
File "/home/image/zxt/PS-GAN/models/models.py", line 19, in create_model
model.initialize(opt)
File "/home/image/zxt/PS-GAN/models/pix2pix_model.py", line 43, in initialize
self.netD_person = networks.define_person_D(opt.input_nc, opt.ndf, opt, use_sigmoid, self.gpu_ids)
File "/home/image/zxt/PS-GAN/models/networks.py", line 85, in define_person_D
netD = PersonDiscriminator(input_nc, ndf, use_sigmoid, gpu_ids=gpu_ids)
TypeError: init() got multiple values for keyword argument 'gpu_ids'

@yifanjiang19
Copy link
Owner

Could you please try to replace it with PersonDiscriminator(input_nc, ndf, gpu_ids=gpu_ids) ?

@zxt-triumph
Copy link
Author

Thank you for your help!

@sevmardi sevmardi mentioned this issue Dec 13, 2018
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