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

Errors when running on CPU without CUDA #172

Open
davidvfx07 opened this issue Aug 28, 2022 · 0 comments
Open

Errors when running on CPU without CUDA #172

davidvfx07 opened this issue Aug 28, 2022 · 0 comments

Comments

@davidvfx07
Copy link

davidvfx07 commented Aug 28, 2022

When I set --gpu_id=-1, I start getting errors from the models when they are initialized like

Traceback (most recent call last):
  File "train.py", line 148, in <module>
    train()
  File "train.py", line 28, in train
    models = create_model(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\models.py", line 76, in create_model
    modelG.initialize(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\vid2vid_model_G.py", line 59, in initialize
    self.n_frames_per_gpu = min(self.opt.max_frames_per_gpu, self.opt.n_frames_total // self.n_gpus) # number of frames in each GPU
ZeroDivisionError: integer division or modulo by zero

When then setting --n_gpus_gen 1 it gets through that error but then comes

Traceback (most recent call last):
  File "train.py", line 148, in <module>
    train()
  File "train.py", line 28, in train
    models = create_model(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\models.py", line 78, in create_model
    modelD.initialize(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\vid2vid_model_D.py", line 22, in initialize
    self.gpu_ids = ([opt.gpu_ids[0]] + opt.gpu_ids[gpu_split_id:]) if opt.n_gpus_gen != len(opt.gpu_ids) else opt.gpu_ids
IndexError: list index out of range

Forcefully setting it to -1 fixes it but then gives me

Traceback (most recent call last):
  File "train.py", line 148, in <module>
    train()
  File "train.py", line 28, in train
    models = create_model(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\models.py", line 78, in create_model
    modelD.initialize(opt)
  File "C:\Users\moish\Desktop\vid2vid\models\vid2vid_model_D.py", line 37, in initialize
    opt.num_D, not opt.no_ganFeat, gpu_ids=self.gpu_ids)
  File "C:\Users\moish\Desktop\vid2vid\models\networks.py", line 66, in define_D
    netD.cuda(gpu_ids[0])
  File "C:\Users\moish\.conda\envs\vid2vid\lib\site-packages\torch\nn\modules\module.py", line 304, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "C:\Users\moish\.conda\envs\vid2vid\lib\site-packages\torch\nn\modules\module.py", line 201, in _apply
    module._apply(fn)
  File "C:\Users\moish\.conda\envs\vid2vid\lib\site-packages\torch\nn\modules\module.py", line 201, in _apply
    module._apply(fn)
  File "C:\Users\moish\.conda\envs\vid2vid\lib\site-packages\torch\nn\modules\module.py", line 223, in _apply
    param_applied = fn(param)
  File "C:\Users\moish\.conda\envs\vid2vid\lib\site-packages\torch\nn\modules\module.py", line 304, in <lambda>
    return self._apply(lambda t: t.cuda(device))
RuntimeError: Device index must not be negative

I'm stuck y'all.

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

1 participant