hongsukchoi / TCMR_RELEASE

Official Pytorch implementation of "Beyond Static Features for Temporally Consistent 3D Human Pose and Shape from a Video", CVPR 2021
MIT License
291 stars 39 forks source link

how to run demo on CPU #18

Open sychou11 opened 2 years ago

sychou11 commented 2 years ago

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.

hongsukchoi commented 2 years ago

Did you also change the code here?

sychou11 commented 2 years ago

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

AhmedBourouis commented 2 years ago

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

hongsukchoi commented 2 years ago

@AhmedBourouis

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

AhmedBourouis commented 2 years ago

@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 ?

hongsukchoi commented 2 years ago

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']