deepratna-awale / AutoExpress

Automatically creates character expressions from given image using A1111 Stable Diffusion API (with ADetailer).
MIT License
6 stars 1 forks source link

Could not find adetailer extension #1

Closed Jatilq closed 3 months ago

Jatilq commented 3 months ago

I love the idea of this app and think I would like using it more than VRM, but I can't seem to get it to work. I am using the directml version of stable fusion and everything is installed correctly. Adetailer Screenshot 2024-05-20 124202 is installed and the box is checked in Stable Diffusion.

[autoexpress.modules.logger] [ERROR] Could not find adetailer extension [2024-05-20 12:02:20,649] ERROR in app: Exception on /generate [POST] Traceback (most recent call last): File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 883, in full_dispatch_request return self.finalize_request(rv) File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 902, in finalize_request response = self.make_response(rv) File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 1174, in make_response raise TypeError( TypeError: The view function for 'generate' did not return a valid response. The function either returned None or ended without a return statement. 127.0.0.1 - - [20/May/2024 12:02:20] "POST /generate HTTP/1.1" 500 -

deepratna-awale commented 3 months ago

@Jatilq Hi, I would like to make sure of the following things before I try to debug:

  1. Are you using the A1111 Stable diffusion Web UI? (It does not support other APIs)
  2. Have you run the webui with API exposed? (you can check if your webui-user.bat file in your stable diffusion web UI directory has the command line argument "--api").
  3. When you press the connect button on the UI does it turn green.

If yes, then redo the process again according to the Guide and post the log.log file found in the repo's Output folder here.

Jatilq commented 3 months ago

Thank you for responding. Yes to all questions. I am using it with directml if that makes a difference. It connects, turns green. I can load models from stable diffusion, but nothing happens when I click generate. Only that error message on the console.

deepratna-awale commented 3 months ago

Can you please re run the program and post the log file here (It will give me a lot more info regarding your problem).

Jatilq commented 3 months ago

Please forgive me if I misunderstood. Do you mean log from console or is there a log file I am missing? A small change. I generated an image in SD. Saved it and loaded it in AutoExpress and it filled in the prompts.

E:\Ai\SillyTavern-Launcher\image-generation\AutoExpress>flask --app autoexpress run

deepratna-awale commented 3 months ago

@Jatilq There is a log.log file in AutoExpress/Output/ I meant that file. Also I've pushed a small change to the repo that should take care of the last error message and give me more info on your problem. Pl pull the repo, try again and send log file.

Jatilq commented 3 months ago

*** Error loading script: !adetailer.py Traceback (most recent call last): File "E:\Ai\SillyTavern-Launcher\image-generation\stable-diffusion-webui-directml\modules\scripts.py", line 508, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "E:\Ai\SillyTavern-Launcher\image-generation\stable-diffusion-webui-directml\modules\script_loading.py", line 13, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "E:\Ai\SillyTavern-Launcher\image-generation\stable-diffusion-webui-directml\extensions-builtin\adetailer\scripts!adetailer.py", line 15, in from rich import print ModuleNotFoundError: No module named 'rich'

Could this be the issue?

deepratna-awale commented 3 months ago

try this: https://github.com/vladmandic/automatic/issues/291#issuecomment-1517478722 It seems the error is with your adetailer not AutoExpress. Also make sure you have pulled the new changes I mentioned above. Also next time you install something, make sure you've activated the venv for the respective project (if it has one) Please drop the log file instead of pasting all of the stuff in it

deepratna-awale commented 3 months ago

@Jatilq Pls tell me if it worked or not so I can close the issue

Jatilq commented 3 months ago

I posted in Stable Diffusion somehow when I thought I was responding here. He deleted the comment.

Moved both apps to another drive did a new pull, install of AutoExpress. Maybe a permissions thing on the ssd it was on. was able to install adetailer no problem. Now getting this error.

C:\Apps\AutoExpress>flask --app autoexpress run

Serving Flask app 'autoexpress' Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. Running on http://127.0.0.1:5000/ Press CTRL+C to quit 127.0.0.1 - - [20/May/2024 14:55:55] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/stylesheet/sidebar.css HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/main.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/stylesheet/main.css HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/connect.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/image_drag_and_drop.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/generate.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/image_viewer.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/stylesheet/toggle.css HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/js/anime_toggle.js HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/stylesheet/image_viewer.css HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/ico/favicon-rounded.png HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/stylesheet/image_and_prompt.css HTTP/1.1" 304 - 127.0.0.1 - - [20/May/2024 14:55:55] "GET /static/ico/favicon-rounded.png HTTP/1.1" 304 - [autoexpress.modules.logger] [INFO] SD URL set to: http://127.0.0.1:7860/ 127.0.0.1 - - [20/May/2024 14:56:12] "POST /receive_data HTTP/1.1" 200 - 127.0.0.1 - - [20/May/2024 14:56:12] "GET /get-loras HTTP/1.1" 200 - 127.0.0.1 - - [20/May/2024 14:56:12] "GET /get-models HTTP/1.1" 200 - 127.0.0.1 - - [20/May/2024 14:56:12] "GET /get-samplers HTTP/1.1" 200 - 127.0.0.1 - - [20/May/2024 14:56:36] "POST /upload HTTP/1.1" 200 - [autoexpress.modules.logger] [INFO] Found adetailer extension. [autoexpress.modules.logger] [INFO] adetailer extension is enabled. [autoexpress.modules.logger] [INFO] Using the following generation parameters: [REDACTED] [2024-05-20 14:56:43,218] ERROR in app: Exception on /generate [POST] Traceback (most recent call last): File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\Jatilq\miniconda3\lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] File "C:\Apps\AutoExpress\autoexpress\views.py", line 197, in generate generate.generate_expressions( AttributeError: 'function' object has no attribute 'generate_expressions' 127.0.0.1 - - [20/May/2024 14:56:43] "POST /generate HTTP/1.1" 500 - log file

2024/05/20 14:52:41 [INFO ] SD URL set to: http://127.0.0.1:7860/ 2024/05/20 14:53:25 [ERROR ] Could not find adetailer extension 2024/05/20 14:54:42 [INFO ] Found adetailer extension. 2024/05/20 14:54:42 [INFO ] adetailer extension is enabled. 2024/05/20 14:54:42 [INFO ] �[36mUsing the following generation parameters: [REDACTED] 2024/05/20 14:55:08 [INFO ] Found adetailer extension. 2024/05/20 14:55:08 [INFO ] adetailer extension is enabled. 2024/05/20 14:55:08 [INFO ] �[36mUsing the following generation parameters: [REDACTED] 2024/05/20 14:56:12 [INFO ] SD URL set to: http://127.0.0.1:7860 2024/05/20 14:56:43 [INFO ] Found adetailer extension. 2024/05/20 14:56:43 [INFO ] adetailer extension is enabled. 2024/05/20 14:56:43 [INFO ] �[36mUsing the following generation parameters: [REDACTED] 2024/05/20 15:00:22 [INFO ] Found adetailer extension. 2024/05/20 15:00:22 [INFO ] adetailer extension is enabled. 2024/05/20 15:00:22 [INFO ] �[36mUsing the following generation parameters: �[0m{'ad_inpaint_width': '832', 'ad_inpaint_height': '1216', 'seed': '1212253171', 'ad_prompt': 'Smile', 'ad_negative_prompt': '', 'ad_steps': '32', 'ad_checkpoint': 'realcartoon3d_v15', 'ad_sampler': 'DPM++ 2M', 'ad_clip_skip': '2', 'ad_cfg_scale': '7', 'ad_denoising_strength': '0.5'} 2024/05/20 15:00:44 [INFO ] Found adetailer extension. 2024/05/20 15:00:44 [INFO ] adetailer extension is enabled. 2024/05/20 15:00:44 [INFO ] �[36mUsing the following generation parameters: �[0m{'ad_inpaint_width': '832', 'ad_inpaint_height': '1216', 'seed': '1212253171', 'ad_prompt': 'Smile', 'ad_negative_prompt': '.', 'ad_steps': '32', 'ad_checkpoint': 'realcartoon3d_v15', 'ad_sampler': 'DPM++ 2M', 'ad_clip_skip': '2', 'ad_cfg_scale': '7', 'ad_denoising_strength': '0.5'}

deepratna-awale commented 3 months ago

It seems like a namespace problem; the program is getting confused between the generate function in views and the module I've imported as generate. I've pushed a new update to the code to remove the confusion.

PS: Your adetailer prompt should ideally contain only info regarding face like "blue eyes, round nose, red lips," and preferably lora's related to character if already used any. Lora can be selected in the sidebar menu or the format should be ""

DO NOT put words like smile, etc, these words will be automatically injected by AutoExpres before sending it for Generation

From a performance standpoint, consider using adetailer inpaint height and width of 512.

Jatilq commented 3 months ago

When I loaded that picture it filled the prompts. Thank you for all your help. I been having little problems with apps, because I have an AMD card so I can dual boot into MacOs. I got frustrated, deleted that and tried Ubuntu/PopOS, but SillyTavern did not want to work right. Thank you for the time.

deepratna-awale commented 3 months ago

When I loaded that picture it filled the prompts. Thank you for all your help. I been having little problems with apps, because I have an AMD card so I can dual boot into MacOs. I got frustrated, deleted that and tried Ubuntu/PopOS, but SillyTavern did not want to work right. Thank you for the time.

I think you should be good to use AutoExpress as long as you can also use inpaint manually on your system.

Jatilq commented 3 months ago

"I think you should be good to use AutoExpress as long as you can also use inpaint manually on your system."

I didnt understand this.

Just tried again. Left sliders at defaul. Just added items from the drop down and what you see in the pictures

Screenshot 2024-05-20 202215 Screenshot 2024-05-20 202133

deepratna-awale commented 3 months ago

Pull the latest release: goto the AutoExpress directory in terminal: git pull

Jatilq commented 3 months ago

Screenshot 2024-05-20 213838

Jatilq commented 3 months ago

Its working!

deepratna-awale commented 3 months ago

The problem seems to be caused by the WebUI you are using, as it is expecting different JSON data compared to what I am sending to the A1111 SD API.

I have a couple solutions for you:

First, try reducing width, height in the sidebar to 256.

If that does not work, follow the below step by step:

deepratna-awale commented 3 months ago

Its working!

What did you change. Please share the solution here.

Jatilq commented 3 months ago

Not which one of these did it, pip install -e . git pull Removed --xformers from COMMANDLINE_ARGS=, tried that when I saw it was saying to reinstall. Started working, but with no expressions. adetailer was not checked in SD

deepratna-awale commented 3 months ago

So does it work now? Do you have expressions now?

Jatilq commented 3 months ago

Yes. I know it was a pain in the butt for you. I been using perchance and Rembg to create the expressions. This is so much better. VRM and live2d are nice, but this is so much better.

deepratna-awale commented 3 months ago

@Jatilq Thank you man, do star the repo if you like it. And no sweat, I made this app to help people.