Code Monkey home page Code Monkey logo

Comments (8)

alwynmathew avatar alwynmathew commented on May 17, 2024 3

Set gpu_ids as -1 to run in cpu.

if opt.isTrain and len(opt.gpu_ids) and not opt.fp16:

if gpu_ids is not set to -1, model will be wrapped in DataParallel

model = torch.nn.DataParallel(model, device_ids=opt.gpu_ids)

when its wrapped in DataParallel, everything in model can be only access like model.module.something

Hope this helped.

from pix2pixhd.

kex243 avatar kex243 commented on May 17, 2024 1

You can remove all instances of ".module" in train.py if commenting in models.py if opt.isTrain and len(opt.gpu_ids) and not opt.fp16: model = torch.nn.DataParallel(model, device_ids=opt.gpu_ids)

from pix2pixhd.

tcwang0509 avatar tcwang0509 commented on May 17, 2024

Which line in which file does this occur?

from pix2pixhd.

alwynmathew avatar alwynmathew commented on May 17, 2024

I couldn’t find a module in model. Could you point me to the code section where its defined.
AttributeError: 'model' object has no attribute 'module'

from pix2pixhd.

oatmeal3000 avatar oatmeal3000 commented on May 17, 2024

When I use cpu only without GPU

create web directory ./checkpoints/melody/web...
Traceback (most recent call last):
File "train.py", line 48, in
optimizer_G, optimizer_D = model.module.optimizer_G, model.module.optimizer_D
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 772, in getattr
type(self).name, name))
torch.nn.modules.module.ModuleAttributeError: 'Pix2PixHDModel' object has no attribute 'module'

from pix2pixhd.

joel1895 avatar joel1895 commented on May 17, 2024

I am also facing the error, any solution for this?

from pix2pixhd.

kondela avatar kondela commented on May 17, 2024

Any chance you are trying to run it using PyTorch >= 1.0 and on cpu? Try PyTorch 1.5/1.6 and a GPU

from pix2pixhd.

AyeshaShafique avatar AyeshaShafique commented on May 17, 2024

i also need solution @joel1895

from pix2pixhd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.