benrugg / AI-Render

Stable Diffusion in Blender
MIT License
1.07k stars 81 forks source link

Local SD Installation Terminal shows no response #98

Closed Clemens-Trubi closed 1 year ago

Clemens-Trubi commented 1 year ago

Hi! I managed to install the Plugin and also the Local SD Version. It runs very well with the Web Ui so the model itself works. When i try to start a render Process through Blender it somehow doesn't start the Render Process. It works with the DreamStudio Cloud version so everything seems to work for itself but when I try to connect Blender Ai Render to the Terminal Web Ui it somehow doesn't work.

PS: Yes I have the Web Tab closed when I try to test it in Blender.

I appreciate every Tip/Help for that issue :)

benrugg commented 1 year ago

Sorry to hear that it's not working. Are you seeing an error in the AI Render panel? (It should show a red icon and an error message). I would guess that there's a message there and it's just hidden. Blender makes it really hard for add-on creators to reliably show messages!

On the small chance there's no error message, then there should be an error in the logs. On the new issue page, there's instructions for how to find the logs.

I will close this for now, but if you find an error in the logs, paste it here and I'll reopen it.

Clemens-Trubi commented 1 year ago

Thanks for replying! I really appreciate your effort on making your Tool available for everyone :)

I know how an error message from Ai Render Looks because earlier on I had another issue where I got an Error message. (I managed to fix that :D ) Unfortunately this Issue does not give me an Error Message but I managed to find the Log file from Blender with an Error that says:

Device with name Apple M1 Pro supports metal minimum requirements METAL API - DETECTED GPU: Apple M1 Pro **Pillow is not installed, therefore:

This Part shows up very often so I think that might be the problem. I can't figure out what that should mean...

benrugg commented 1 year ago

Hmm, that's weird. I think that error might just be showing up from either Blender's internals or a different add-on. I don't think that's related to AI Render.

Is there more to the log? You can paste the entire thing, even if it's huge. Separately, are you seeing any change in the Automatic1111 terminal window when you render?

benrugg commented 1 year ago

One more thought. I know you said that the Automatic1111 web ui is running fine. (Which is very helpful info). Did you also follow the steps to run it in API mode? https://github.com/benrugg/AI-Render/wiki/Local-Installation

Clemens-Trubi commented 1 year ago

This is the whole Log as I run the comment in the log and tried to render again. I think there are some other Plugins in the log too so maybe not everything is interesting or relevant.

Last login: Wed Apr 26 18:54:01 on ttys001 /Applications/Blender\ 3.2.0.app/Contents/MacOS/Blender ; exit;
clemensschoeneboom@Clemenss-MBP ~ % /Applications/Blender\ 3.2.0.app/Contents/MacOS/Blender ; exit; Read prefs: /Users/clemensschoeneboom/Library/Application Support/Blender/3.2/config/userpref.blend Pillow is not installed, therefore:

Clemens-Trubi commented 1 year ago

I think I followed every step to run this into API mode. Is there any way I can re check that? Would It might be helpful to post my terminal data when I type the vi webui-user.sh command?

benrugg commented 1 year ago

Hmm, weird. I don't see anything in that error log that is related to AI Render. There's gotta be something going on, but I'm really not sure what it is.

You can verify that automatic1111 is running in API mode by going to this link: http://127.0.0.1:7860/docs#/default

If you see POST /sdapi/v1/img2img listed (somewhat far down the page) then it is running in API mode. If that's not there, then it isn't.

I think on top of that, in the automatic1111 terminal, it should show the options it started with. So it should say something like Launching Web UI with arguments: --api ...

Clemens-Trubi commented 1 year ago

Okay that might be the issue! I don't see: POST /sdapi/v1/img2img Down below I tried to paste in a picture of the Api related "Post" sections I found. Also When the Ui is launching there is following passage: Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate

Should there be the section you wrote about? (Launching Web UI with arguments: --api ...)

If that is the issue, how do I manage to solve that? :D

Bildschirm­foto 2023-04-27 um 21 52 49
Clemens-Trubi commented 1 year ago

So I tried to do that API part again and changed the part mit Command into --api and it looks like this:

!/bin/bash

#########################################################

Uncomment and change the variables below to your need:

#########################################################

Install directory without trailing slash

install_dir="/home/$(whoami)"

Name of the subdirectory

clone_dir="stable-diffusion-webui"

Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention"

export COMMANDLINE_ARGS="--api"

python3 executable

python_cmd="python3"

git executable

export GIT="git"

python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)

venv_dir="venv"

script to launch to start the app

export LAUNCH_SCRIPT="launch.py"

install command for torch

export TORCH_COMMAND="pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113"

Requirements file to use for stable-diffusion-webui

export REQS_FILE="requirements_versions.txt"

Fixed git repos

export K_DIFFUSION_PACKAGE=""

export GFPGAN_PACKAGE=""

Fixed git commits

export STABLE_DIFFUSION_COMMIT_HASH=""

export TAMING_TRANSFORMERS_COMMIT_HASH=""

export CODEFORMER_COMMIT_HASH=""

export BLIP_COMMIT_HASH=""

Uncomment to enable accelerated launch

export ACCELERATE="True"

"########################################### ~
~
~
~
~
~
~
~
~
~
~
"webui-user.sh" [readonly] 45L, 1319B

But now when I run the ./webui.sh command after that I get following error message:

clemensschoeneboom@Clemenss-MBP stable-diffusion-webui % ./webui.sh

./webui-user.sh: line 45: unexpected EOF while looking for matching `"' ./webui-user.sh: line 46: syntax error: unexpected end of file

################################################################ Install script for stable-diffusion + Web UI Tested on Debian 11 (Bullseye) ################################################################

################################################################ Running on clemensschoeneboom user ################################################################

################################################################ Repo already cloned, using it as install directory ################################################################

################################################################ Create and activate python venv ################################################################

################################################################ Launching launch.py... ################################################################ Python 3.10.11 (main, Apr 7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)] Commit hash: 22bcc7be428c94e9408f589966c2040187245d81 Traceback (most recent call last): File "/Users/clemensschoeneboom/stable-diffusion-webui/launch.py", line 355, in prepare_environment() File "/Users/clemensschoeneboom/stable-diffusion-webui/launch.py", line 260, in prepare_environment run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'") File "/Users/clemensschoeneboom/stable-diffusion-webui/launch.py", line 121, in run_python return run(f'"{python}" -c "{code}"', desc, errdesc) File "/Users/clemensschoeneboom/stable-diffusion-webui/launch.py", line 97, in run raise RuntimeError(message) RuntimeError: Error running command. Command: "/Users/clemensschoeneboom/stable-diffusion-webui/venv/bin/python3.10" -c "import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'" Error code: 1 stdout: stderr: Traceback (most recent call last): File "", line 1, in AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

Somehow there's gotta be something im doing wrong...

benrugg commented 1 year ago

Yep, that's definitely the issue. And you should be really close. You need to keep the original flags in that line and just add the api part. So for your configuration, it should look like this this:

export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate --api"

If you update that file with that line, it should all work! 🤞

benrugg commented 1 year ago

I'm going to close this as an issue, since it's not a bug with AI Render. But keep me updated!

Clemens-Trubi commented 1 year ago

It worked!! WOW! Thank you so much! I knew it gotta be something with my poor programming Skills :D

I really appreciate your support and help! Again - Thank you! :) Looking forward to use your Plugin a lot now!

benrugg commented 1 year ago

Great! Really glad to hear that. Automatic1111 is a beast to set up. Especially if you don't work with files in a terminal environment for a living 😅

I hope you enjoy using the add-on!

Clemens-Trubi commented 1 year ago

I haven't touched one single line of code in my life before, because I was a Designer with a fear of code :D but after this whole thing it looks a bit different ;)

Im sure I will! Have a good one!

benrugg commented 1 year ago

If it makes you feel better, I've worked with code for over 20 years, and I still hate touching things like these automatic1111 config files, and installing python, etc. Usually coding is a lot easier!