shunsukesaito / PIFu

This repository contains the code for the paper "PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization"
https://shunsukesaito.github.io/PIFu/
Other
1.76k stars 341 forks source link

Multi-GPUs issue #28

Open waldstein94 opened 4 years ago

waldstein94 commented 4 years ago

Hello shunsuke, I'm here again :)

I've tried to run the code with multiple GPUs but it did not seem to work.

At first, I rewrote and ran codes in def init_net (net_util.py) , but just one gpu worked except very few increasing memory allocation in other GPUs. How do I use this code with multi GPU?

Second, I added the torch.nn.Dataparallel with 'netG' in line 50(train_shape.py) but some error related to 'mismatching gpu between model and input' had been occured. Have you met kind of this error when you tried to use multiple GPUs?

Thank you in advance, I'll wait your response!

shunsukesaito commented 4 years ago

I pushed a small fix. Can you merge your multi-gpu code with it and see if it works?

shunsukesaito commented 4 years ago

The current code in the repository does not support multi-GPU training. The easiest way to use multi-gpu is using torch.nnDataparallel. But make sure you adjust code for gen_mesh and error evaluation.

waldstein94 commented 4 years ago

After adding few codes to main file, code is well running now. However, I didn't adjust any code for gen_mesh. Do you think it will make a problem? Also, can I ask what how you modified the code to work?

Anyway, thank you soooooooooo much for your fast and caring feed back. It really helped me a lot!

shunsukesaito commented 4 years ago

I meant you have to pass netG.module instead of netG if you replace the network with torch.dataparallel. You don't have to change code inside gen_mesh itself. Glad that it worked out. Would it be possible to send pull request with multi-GPU support if you don't mind? (I just haven't had time to do it by myself, thanks!)

waldstein94 commented 4 years ago

Of course, but it may take time because I'm very beginner of GitHub. If you are okay with it, I'll try :)