LS4GAN / uvcgan

Code accompanying UVCGAN paper
https://arxiv.org/abs/2203.02557
Other
133 stars 22 forks source link

Is there any modification that is required to be done in the program to make it run on GPU ? #12

Open Deepika1498 opened 1 year ago

Deepika1498 commented 1 year ago

My laptop has GPU but the program is still running on CPU . Could you please help me solve this? My laptop configuration is attached in the pictures below. hw1 hw2

YHRen commented 1 year ago

Hi @Deepika1498

My best bet is to install conda and follow the pytorch installation for "windows + conda + CUDA": https://pytorch.org/get-started/locally/

usert5432 commented 1 year ago

Hi @Deepika1498,

There is no need to make any modifications to the uvcgan code -- it should detect the GPU automatically.

I think @YHRen is correct and your pytorch got installed without the CUDA support. Unfortunately, I do not have a Windows machine to test the exact fix procedure, but I think I would to the following to solve the problem:

  1. First, I would test if pytorch can see the GPU by running the following command in your conda environment:

    python -c 'import torch; print(torch.cuda.is_available())'

    If the output is False, then your pytorch does not have GPU support and you would need to reinstall it. If it prints True, then we would need to ask you a few more questions to help with the investigation.

  2. In the following, I assume that your pytorch does not have a GPU support. In this case, please create a new conda environment from scratch and install pytorch with GPU support according to the instructions that @YHRen provided. After the installation, please rerun the test from item 1 to make sure that the reinstalled pytorch can find the GPU.

  3. If the reinstalled pytorch works, then you would need to install a few extra conda packages:

    conda install tqdm pillow pandas
  4. After that, you can install uvcgan to your conda environment as described in the README . And, everything should work with the GPU support.

hrituraj-hr commented 1 year ago

I am running the code on VS code with i7 CPU and getting the following output and in the last process is killed How can i fix this

/usr/local/lib/python3.10/dist-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] [2023-05-01 14:47:18,994] [uvcgan.base]: DEBUG Initializnig network with normal [2023-05-01 14:47:19,499] [uvcgan.base]: DEBUG Initializnig network with normal [2023-05-01 14:47:19,780] [uvcgan.base]: DEBUG Initializnig network with normal [2023-05-01 14:47:19,855] [uvcgan.base]: DEBUG Initializnig network with normal Adjusting learning rate of group 0 to 1.0000e-04. Adjusting learning rate of group 0 to 1.0000e-04. [2023-05-01 14:47:19,896] [uvcgan.train]: INFO Initiating parameter transfer : '{'base_model': 'selfie2anime/model_d(cyclegan)_m(autoencoder)_d(None)_g(vit-unet)_bert-vit-unet-12-256', 'transfer_map': {'gen_ab': 'encoder', 'gen_ba': 'encoder'}, 'strict': True, 'allow_partial': False}' [2023-05-01 14:47:20,329] [uvcgan.base]: DEBUG Initializnig network with normal Epoch 00000: adjusting learning rate of group 0 to 6.2500e-04. [2023-05-01 14:47:20,605] [uvcgan.cgan]: DEBUG Loading model from epoch None Epoch 1 / 500: 0%| | 1/2000 [00:25<13:55:01, 25.06s/it, gen_ab=1.47, gen_ba=3.08, cycle_a=3.12, cycle_b=1.94, disc_a=2.17, disc_b=1.53, idt_a=1.61, idt_b=0.974] Killed

usert5432 commented 1 year ago

Hi @hrituraj-hr,

I am running the code on VS code with i7 CPU and getting the following output and in the last process is killed How can i fix this

It looks like an Out of Memory (OOM) situation to me, but it is hard to tell from the log itself. We could try to diagnose the situation if you like. For that, I would need to ask a few questions about your system, starting with what is your operating system (OS) is? Which script are you trying to run? Whether you have a GPU? And how much RAM do you have?