Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Deepika1498 opened this issue Dec 14, 2022 · 4 comments

Comments

@Deepika1498
Copy link

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
Copy link
Contributor

YHRen commented Dec 14, 2022

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
Copy link
Collaborator

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.

  1. 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.

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

conda install tqdm pillow pandas
  1. 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
Copy link

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
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants