nv-tlabs / editGAN_release

Other
628 stars 88 forks source link

Failure getting EditGAN to run in Colab #8

Open dubtor opened 2 years ago

dubtor commented 2 years ago

Thanks for sharing your code! I tried getting this to load up in Google Colab. After some hassle and experimenting, I got it to the state where it's loading up at least.

If I try to click something like checking the box, or uploading a file, I see the following reports:

image image

The UI seems unresponsive. It is not perfectly clear whether that is due to a problem, or because I don't know how to use the software. Any hints?

Thank you 🙏

dubtor commented 2 years ago

Well, just seeing myself that it semed to have failed to load the demo_origin.js -- which is probably the reason it fails to see the JS functions. Will update this issue.

arieling commented 2 years ago

Demo js is at static/demo_origin.js

Could you please also let me know how it's going on google Colab? Would like to help and update the Colab option in released code if possible

dubtor commented 2 years ago

Thank you @arieling - I have not yet gotten it to work properly, but at least solved the initial problem (which is why I am also adjust the title of this ticket).

I managed to create a colab environment using the mentioned package versions and added ngrok to run_app.py to create a tunnel from the localhost:8888 to a public URL. I had some trouble loading the local files from within the 'index.html' because they seemed to be a CORS issues, so the files 'demo_origin.js' and 'demo.css' would not load. I was able to work around this for the moment by inlining both the script and the CSS into the index.html itself.

I got the app loading up now and I can draw on the left and click the middle button (which I guess from the videos is the 'process' button). Once I click it, it looks like the app is running out of CUDA memory.

This is where I am currently at. I dont know if the memory is really full, or if maybe something else isn't working properly. I am running on Google Colab Pro+ with extended RAM.

The reported hardware is `Sun Apr 10 12:35:19 2022
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Tesla P100-PCIE... Off | 00000000:00:04.0 Off | 0 | | N/A 35C P0 27W / 250W | 0MiB / 16280MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+`

The log report of the run_app.py is as follows: `ngrok: no process found Starting server... Server ready... Open URL in browser: NgrokTunnel: "http://e171-34-90-74-42.ngrok.io/" -> "http://localhost:8888/"

dubtor commented 2 years ago

@arieling I can invite you to the Colab if you like, even though some of the settings will be fixed to my system. Feel free to reach out via Telegram @dubtor

udibr commented 2 years ago

@dubtor I managed to run your fork on colab using this notebook https://colab.research.google.com/drive/14nY3p9GG-yfzMziySVqs2zZZk5ArXFiY?usp=sharing

dubtor commented 2 years ago

Thanks @udibr for sharing! Does this colab run the full demo for you? I tried to run yours, and in my case, it is still running out of CUDA memory, same like my own previous tests with an own Colab notebook. My own version run until I clicked the "process" button on the web UI. Yours was running OOM already during the bootup of the web app. I was using the GPU version on Colab+. Have you done anything differently? Thank you!

udibr commented 2 years ago

I occasionally do get OOM but most of the time not. It could be its because I'm using "Clab Pro" which gives you a better priority on the GPU card being used.

I did manage to modify the tire and headlights of the car image which was fun, but I have no idea how to use the rest of the features of this App

udibr commented 2 years ago

I just tried again and indeed got OOM I then did "Runtime->Disconnect and delete run time" and re run the notbook and it works

udibr commented 2 years ago

looks like adding the following code at the very top of run_app.py helps:

import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:1000"
import torch
torch.cuda.empty_cache()
arieling commented 2 years ago

Maybe you want to make the editing region smaller to test first. Once you can deploy the model, the memory depends on your editing region area.

wandrzej commented 2 years ago

looks like adding the following code at the very top of run_app.py helps:

import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:1000"
import torch
torch.cuda.empty_cache()

I've tried that fix and still getting the out of memory error on a P100 Restarting the runtime also didn't help.

One difference from the previous descriptions of the problem is that I can't get the url to open anything.

Ley-lele commented 2 years ago

looks like adding the following code at the very top of run_app.py helps:

import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:1000"
import torch
torch.cuda.empty_cache()

I've tried that fix and still getting the out of memory error on a P100 Restarting the runtime also didn't help.

One difference from the previous descriptions of the problem is that I can't get the url to open anything.

I met the same problem as yours. U may like to check your projects follow the link below https://blog.csdn.net/qq_38677322/article/details/109696077