seruva19 / kubin

Web-GUI for Kandinsky text-to-image diffusion models.
177 stars 18 forks source link

error when trying to generate in kandinsky 2.1 web ui #98

Closed demirklvc closed 1 year ago

demirklvc commented 1 year ago

Im getting this error when trying to generate: There is no current event loop in thread 'AnyIO worker thread'.

seruva19 commented 1 year ago

In local mode or cloud service? I once had such an error on Paperspace. But never locally. Can you give some context (stack trace)?

demirklvc commented 1 year ago

@seruva19 locally, running on windows on a 3090ti 24 gb ram. what more infos do you need? i cant really code, please explain to me what info is needed. appreciate your willigness to help, would love to use it.

demirklvc commented 1 year ago

if you interested i could give you access to the computer via rustdesk.

demirklvc commented 1 year ago

locally via gradio web ui server

seruva19 commented 1 year ago

Can you copy the full text of error? There should be a lot of text before the line "There is no current event loop..." - that's what I need to understand the origin of the error.

edit: I mean not the error on the web page, but full error in the app console (command line).

demirklvc commented 1 year ago

i would if i could run kadinsky web ui. tried around 20 times to get ir running, when i use: python src/kubin.py it gives me: module not found: real ersgan.

seruva19 commented 1 year ago

Try to run the following:

python src/kubin.py --disabled-extensions="kd-upscaler"

Does it still give the error?

demirklvc commented 1 year ago

now i get following: ModuleNotFoundError: No module named 'clip_interrogator'

user425846 commented 1 year ago

Why not use „sh start.sh“

keko @.***> schrieb am Fr. 16. Juni 2023 um 21:22:

i would if i could run kadinsky web ui. tried around 20 times to get ir running, when i use: python src/kubin.py it gives me: module not found: real ersgan.

— Reply to this email directly, view it on GitHub https://github.com/seruva19/kubin/issues/98#issuecomment-1595181733, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX6YB4HEPICJNUFUEALS3B3XLSW67ANCNFSM6AAAAAAZJJIMFY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

seruva19 commented 1 year ago

I suspect some extensions were not installed correctly. Run:

python src/kubin.py --safe-mode="use"

This will launch app with disabled extensions. Will it work now?

demirklvc commented 1 year ago

thanks for the tips to both of yall. im now reinstalling and trying with that info. gonna update yall in couple minutes

demirklvc commented 1 year ago

reinstalled and when i try to generate im getting this: 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.

seruva19 commented 1 year ago

Check PyTorch version, what does it output?

python
import torch
torch.__version__
demirklvc commented 1 year ago

pytorch version 3.10.6

demirklvc commented 1 year ago

pytorch version 3.10.6

@seruva19

seruva19 commented 1 year ago

No, it's python version... OK, type this instead: python -c "import torch; print(torch.__version__)"

demirklvc commented 1 year ago

pytoch 2.0

seruva19 commented 1 year ago

Only "2.0"?

demirklvc commented 1 year ago

2.0.1+cpu

seruva19 commented 1 year ago

That means you have CPU version of PyTorch library installed. Happens sometimes; you just have to install proper version manually. Use this:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Installation should take a while. After that, run python -c "import torch; print(torch.__version__)" again. If everything is OK, it should show 2.0.1+cu118. Then try again to launch the webui app and generate something.

demirklvc commented 1 year ago

it is 2.0.1+cu118 now, but getting this: : 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. scanning system information

seruva19 commented 1 year ago

Do you launch webui with start.bat or you do it manually?

demirklvc commented 1 year ago

start.bat

demirklvc commented 1 year ago

appreciate your willigness to help!

demirklvc commented 1 year ago

any idea what i can try now?

seruva19 commented 1 year ago

Hmm, I have a suspicion that it does not actually install torch into webui environment... Let's try the following: create a copy of start.bat file and change its contents to:

call venv\Scripts\activate.bat
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 
python src\kubin.py

(Or you can just create a new .bat file inside 'kubin' folder) Now try to launch this new file and let's see what happens :)

demirklvc commented 1 year ago

alright doing now!

demirklvc commented 1 year ago

Hmm, I have a suspicion that it does not actually install torch into webui environment... Let's try the following: create a copy of start.bat file and change its contents to:

call venv\Scripts\activate.bat
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 
python src\kubin.py

(Or you can just create a new .bat file inside 'kubin' folder) Now try to launch this new file and let's see what happens :)

done. same error message still :/

demirklvc commented 1 year ago

if it helps you could connect to my pc via rust desk

seruva19 commented 1 year ago

This won't help, because I am actually out of ideas now :( Well, I have one more thing to check. Run:

python src/kubin.py --device='cpu'

Will the error change?

demirklvc commented 1 year ago

doesnt work too...:(

seruva19 commented 1 year ago

Launch install.bat and after installation ends run python src/kubin.py --device='cpu' again.

demirklvc commented 1 year ago

Launch install.bat and after installation ends run python src/kubin.py --device='cpu' again.

still same error. here is the full terminal:

To create a public link, set share=True in launch(). scanning system information task queued: text2img clearing memory loading default decoder model loading default prior model Traceback (most recent call last): File "C:\Users\RTX01\kubin\venv\lib\site-packages\gradio\routes.py", line 412, in run_predict output = await app.get_blocks().process_api( File "C:\Users\RTX01\kubin\venv\lib\site-packages\gradio\blocks.py", line 1299, in process_api result = await self.call_function( File "C:\Users\RTX01\kubin\venv\lib\site-packages\gradio\blocks.py", line 1021, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\RTX01\kubin\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\RTX01\kubin\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\Users\RTX01\kubin\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "C:\Users\RTX01\kubin\src\ui_blocks\t2i.py", line 105, in generate return generate_fn(params) File "C:\Users\RTX01\kubin\src\webui.py", line 32, in generate_fn=lambda params: kubin.model.t2i(params), File "C:\Users\RTX01\kubin\src\models\model_kd2.py", line 104, in t2i params = self.prepare("text2img").seed(params) File "C:\Users\RTX01\kubin\src\models\model_kd2.py", line 39, in prepare self.kd2 = get_checkpoint( File "C:\Users\RTX01\kubin\src\engine\kandinsky.py", line 193, in get_checkpoint model = Kandinsky2_1( File "C:\Users\RTX01\kubin\venv\lib\site-packages\kandinsky2\kandinsky2_1_model.py", line 57, in init self.prior.load_state_dict(torch.load(prior_path), strict=False) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 809, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 1172, in _load result = unpickler.load() File "C:\Users\RTX01\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1213, in load dispatchkey[0] File "C:\Users\RTX01\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1254, in load_binpersid self.append(self.persistent_load(pid)) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 1142, in persistent_load typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location)) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 1116, in load_tensor wrap_storage=restore_location(storage, location), File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 217, in default_restore_location result = fn(storage, location) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 182, in _cuda_deserialize device = validate_cuda_device(location) File "C:\Users\RTX01\kubin\venv\lib\site-packages\torch\serialization.py", line 166, in validate_cuda_device raise RuntimeError('Attempting to deserialize object on a CUDA ' 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.

seruva19 commented 1 year ago

Oh, well, OK.. I am sure there exists some simple answer to this. I have to leave now, but we will return to this problem later ;)

demirklvc commented 1 year ago

hopefully. im trying to get this running since hours. thanks for your tryings.

demirklvc commented 1 year ago

hey

seruva19 commented 1 year ago

Hey, how it's going?

demirklvc commented 1 year ago

can we try further to set it up please? would love to use it! :)

seruva19 commented 1 year ago

I would like to help, but I have no idea what's going wrong :( Usually "clean" install (like described here) resolves 80% of errors, but looks like your case is different. Try to launch Powershell terminal and reproduce all the commands (from the link above) step by step.

demirklvc commented 1 year ago

I would like to help, but I have no idea what's going wrong :( Usually "clean" install (like described here) resolves 80% of errors, but looks like your case is different. Try to launch Powershell terminal and reproduce all the commands (from the link above) step by step.

deleted everything, did a clean install via powershell and input everything step by step. still the same error, very frustrating.

seruva19 commented 1 year ago

The same error is "Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False", right?

demirklvc commented 1 year ago

yes

seruva19 commented 1 year ago

Can you open powershell terminal in 'kubin' folder and:

  1. type "nvidia-smi" command, copy the output here
  2. type " ./venv/Scripts/Activate.ps1", then "pip show torch" and also copy the result here
demirklvc commented 1 year ago

yes, doing now!

demirklvc commented 1 year ago

1:

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 527.56 Driver Version: 527.56 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... WDDM | 00000000:04:00.0 On | N/A | | 36% 20C P8 30W / 336W | 799MiB / 24576MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 2652 C+G ...bbwe\Microsoft.Photos.exe N/A | | 0 N/A N/A 4048 C+G ...6.0.3.0\GoogleDriveFS.exe N/A | | 0 N/A N/A 4180 C+G ...y\ShellExperienceHost.exe N/A | | 0 N/A N/A 6124 C+G ...\app-1.0.9013\Discord.exe N/A | | 0 N/A N/A 6604 C+G ...zilla Firefox\firefox.exe N/A | | 0 N/A N/A 7264 C+G ...artMenuExperienceHost.exe N/A | | 0 N/A N/A 8704 C+G C:\Windows\explorer.exe N/A | | 0 N/A N/A 10252 C+G ...5n1h2txyewy\SearchApp.exe N/A | | 0 N/A N/A 10732 C+G ...8wekyb3d8bbwe\Cortana.exe N/A | | 0 N/A N/A 11912 C+G ...cw5n1h2txyewy\LockApp.exe N/A | | 0 N/A N/A 12572 C+G ...2txyewy\TextInputHost.exe N/A | | 0 N/A N/A 13528 C+G ...zilla Firefox\firefox.exe N/A | | 0 N/A N/A 13716 C+G ...e\PhoneExperienceHost.exe N/A | +-----------------------------------------------------------------------------+

demirklvc commented 1 year ago

2:

Version: 2.0.1 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: https://pytorch.org/ Author: PyTorch Team Author-email: packages@pytorch.org License: BSD-3 Location: c:\users\rtx01\kubin\venv\lib\site-packages Requires: filelock, jinja2, networkx, sympy, typing-extensions Required-by: clip, clip-interrogator, fairscale, kandinsky2, open-clip-torch, pytorch-lightning, RealESRGAN, shap-e, timm, torchmetrics, torchvision

seruva19 commented 1 year ago

OK. Now, for completeness of information, I need also the output of this command (the same way, type it in terminal):

git log --pretty=format:'%h' -n 1

demirklvc commented 1 year ago

4b7a962

seruva19 commented 1 year ago

Nice, now let's try this (step by step):

./venv/Scripts/Activate.ps1
python -c "import torch; print(torch.__version__)"
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
python -c "import torch; print(torch.__version__)"
py src/kubin.py

The questions are:

  1. What are the outputs of line 2 and line 4 (versions of pytorch)?
  2. Does the final output (after webui starts) still contains the same error as before?
demirklvc commented 1 year ago

doing now, reporting asap back