first-order-model icon indicating copy to clipboard operation
first-order-model copied to clipboard

AssertionError: Torch not compiled with CUDA enabled

Open khalestorm opened this issue 3 years ago • 4 comments

A few errors:

  1. demo.py:27: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe.
  2. "AssertionError: Torch not compiled with CUDA enabled"

My source video is an mp4 off youtube that's been processed by face-alignment and converted with ffmpeg. Using a 256x256 px source image.

I have a Radeon and not Nvidia GPU, so I want to run this without CUDA

(base) kyle@MacBook-Pro first-order-model % python demo.py --config config/vox-256.yaml --driving_video crop.mp4 --source_image Noe_crop.jpg --checkpoint vox-cpk.pth.tar --relative --adapt_scale demo.py:27: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(f) Traceback (most recent call last): File "demo.py", line 144, in generator, kp_detector = load_checkpoints(config_path=opt.config, checkpoint_path=opt.checkpoint, cpu=opt.cpu) File "demo.py", line 32, in load_checkpoints generator.cuda() File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 463, in cuda return self._apply(lambda t: t.cuda(device)) File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 359, in _apply module._apply(fn) File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 359, in _apply module._apply(fn) File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 359, in _apply module._apply(fn) [Previous line repeated 3 more times] File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 381, in _apply param_applied = fn(param) File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 463, in return self._apply(lambda t: t.cuda(device)) File "/Users/kyle/miniconda3/lib/python3.8/site-packages/torch/cuda/init.py", line 166, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled (base) kyle@MacBook-Pro first-order-model %

khalestorm avatar Mar 01 '21 06:03 khalestorm

Try to add --cpu flag.

AliaksandrSiarohin avatar Mar 01 '21 17:03 AliaksandrSiarohin

For non NVIDIA users: --cpu flag will fix this.

If you get this error with an NVIDIA gpu, you will need to install PyTorch with cuda enabled. You can do that by following the PyTorch install instructions on their GitHub found here.

dylan-cm avatar Mar 25 '21 20:03 dylan-cm

For non NVIDIA users: --cpu flag will fix this.

If you get this error with an NVIDIA gpu, you will need to install PyTorch with cuda enabled. You can do that by following the PyTorch install instructions on their GitHub found here.

How to add --cpu flag?

srajalcodes avatar Mar 30 '21 15:03 srajalcodes

For non NVIDIA users: --cpu flag will fix this. If you get this error with an NVIDIA gpu, you will need to install PyTorch with cuda enabled. You can do that by following the PyTorch install instructions on their GitHub found here.

How to add --cpu flag?

If you are using function such as

from demo import load_checkpoints
generator, kp_detector = load_checkpoints(config_path='config/vox-256.yaml', 
                            checkpoint_path='../resources/model/vox-cpk.pth.tar')

Just pass a parameter cpu = True

from demo import load_checkpoints
generator, kp_detector = load_checkpoints(cpu=True, config_path='config/vox-256.yaml', 
                            checkpoint_path='../resources/model/vox-cpk.pth.tar')

If you are using command line

python demo.py --config config/vox-256.yaml --driving_video crop.mp4 --source_image Noe_crop.jpg --checkpoint vox-cpk.pth.tar --relative --adapt_scale

Add --cpu like

python demo.py --config config/vox-256.yaml --cpu --driving_video crop.mp4 --source_image Noe_crop.jpg --checkpoint vox-cpk.pth.tar --relative --adapt_scale

It works for me.

poinwater avatar Apr 06 '21 03:04 poinwater