TCMR_RELEASE icon indicating copy to clipboard operation
TCMR_RELEASE copied to clipboard

how to run demo on CPU

Open sychou11 opened this issue 2 years ago • 6 comments

I wanted to run demo on CPU so I tried python demo.py --vid_file demo.mp4 --gpu -1 However, it turned out: RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

Then I tried to fix code in demo.py in line 108 and line 127. But it still couldn't work.

sychou11 avatar Nov 19 '21 09:11 sychou11

Did you also change the code here?

hongsukchoi avatar Nov 19 '21 11:11 hongsukchoi

Did you also change the code here? It works, thanks!

sychou11 avatar Nov 23 '21 01:11 sychou11

i did the same thing and i changed the code as follow: demo.py { line 108: ckpt = torch.load(pretrained_file,map_location=torch.device('cpu')) line 127: checkpoint = torch.load(osp.join(BASE_DATA_DIR, 'spin_model_checkpoint.pth.tar'),map_location=torch.device('cpu')) } tcmr.py { line 134: pretrained_dict = torch.load(pretrained,map_location=torch.device('cpu'))['model'] } but I'm still getting this error:

AssertionError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

AhmedBourouis avatar Dec 30 '21 21:12 AhmedBourouis

@AhmedBourouis

Hmm, it seems there is no problem. Would you trying eliminating this line?

hongsukchoi avatar Jan 05 '22 06:01 hongsukchoi

@hongsukchoi
thank you for your answer but i still have the same error even after eliminating that line (line 374 in demo.py) can i run it in google colab ?

AhmedBourouis avatar Jan 06 '22 13:01 AhmedBourouis

No, I haven't prepared google colab codes.

I recommend you follow this instructions to run on CPU. I did the same thing and was able to run TCMR on CPU. In demo.py

L55 : device = torch.device('cpu')
L108: ckpt = torch.load(pretrained_file,map_location=torch.device('cpu'))
L115: model.regressor.smpl = SMPL(
        SMPL_MODEL_DIR,
        batch_size=64,
        create_transl=False,
        gender=gender
    ) #.cuda()
L127: checkpoint = torch.load(osp.join(BASE_DATA_DIR, 'spin_model_checkpoint.pth.tar'),map_location=torch.device('cpu'))

In tcmr.py

L134: pretrained_dict = torch.load(pretrained, map_location=torch.device('cpu'))['model']

hongsukchoi avatar Jan 07 '22 12:01 hongsukchoi