Panchovix / stable-diffusion-webui-reForge

GNU Affero General Public License v3.0
280 stars 10 forks source link

[Bug]: API: png-info is bugged! #8

Closed altoiddealer closed 1 month ago

altoiddealer commented 1 month ago

Checklist

What happened?

When it rains, it pours...

My discord bot accesses the png-info API endpoint in order to get the PNG info.

This endpoint is returning the following error:

http://127.0.0.1:7860/sdapi/v1/png-info response: 500 "Internal Server Error"
{"error":"HTTPException","detail":"Invalid encoded image","body":"","errors":""}

I've dumped the raw base64 string, and the image is valid... if I go to a site like https://base64.guru/converter/decode/image and copy/paste it in, it outputs the image.

But if I go to http://127.0.0.1:7860/docs#/default/pnginfoapi_sdapi_v1_png_info_post and copy/paste the string, it yields the error.

Payload:

img_payload.json

Base64 string returned by http://127.0.0.1:7860/docs#/default/text2imgapi_sdapi_v1_txt2img_post:

img_string_0.json

Note: This silently errors in the Forge CMD window.

Steps to reproduce the problem

  1. Use the API to generate images
  2. Try getting PNG info via png-info endpoint.

What should have happened?

No error.

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-07-11-15-01.json

Console logs

venv "D:\0_AI\stable-diffusion-webui-forge-a1111\venv\Scripts\Python.exe"
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: f0.0.18v1.10.0RC-latest-482-gd77ace3c
Commit hash: d77ace3cb2497bf319f8eab1e4a316cee7259d8e
CUDA 12.1
Installing forge_legacy_preprocessor requirement: changing opencv-python version from 4.10.0.84 to 4.8.0
Installing sd-forge-controlnet requirement: changing opencv-python version from 4.10.0.84 to 4.8.0
Launching Web UI with arguments: --disable-xformers --ckpt-dir 'D:\0_AI\stable-diffusion-webui-forge-a1111\xtra\models' --lora-dir 'D:\0_AI\stable-diffusion-webui-forge-a1111\xtra\Lora' --embeddings-dir 'D:\0_AI\stable-diffusion-webui-forge-a1111\xtra\embeddings' --ui-settings-file 'D:\0_AI\stable-diffusion-webui-forge-a1111\xtra\config-alt.json' --cuda-stream --api --listen --api-server-stop
Total VRAM 12282 MB, total RAM 32536 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4070 Ti : native
Hint: your device supports --pin-shared-memory for potential speed improvements.
Hint: your device supports --cuda-malloc for potential speed improvements.
VAE dtype: torch.bfloat16
CUDA Stream Activated:  True
Using pytorch cross attention
ControlNet preprocessor location: D:\0_AI\stable-diffusion-webui-forge-a1111\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.6.0, num models: 10
WARNING:dinov2:xFormers not available
WARNING:dinov2:xFormers not available
11:00:28 - ReActor - STATUS - Running v0.7.1-a1 on Device: CUDA
Loading model sdxl\RealitiesEdgeXLSDXL_V7Bakedvae.safetensors [83d30d3dfb] (1 out of 1)
Loading weights [83d30d3dfb] from D:\0_AI\stable-diffusion-webui-forge-a1111\models\Stable-diffusion\sdxl\RealitiesEdgeXLSDXL_V7Bakedvae.safetensors
2024-07-11 11:00:29,323 - ControlNet - INFO - ControlNet UI callback registered.
model_type EPS
UNet ADM Dimension 2816
Running on local URL:  http://0.0.0.0:7860
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids'}
left over keys: dict_keys(['conditioner.embedders.1.model.transformer.text_model.embeddings.position_ids'])
To load target model SDXLClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  11025.6337890625
[Memory Management] Model Memory (MB) =  2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  7857.279090881348
Moving model(s) has taken 0.51 seconds
Model loaded in 5.2s (load weights from disk: 0.7s, forge load real models: 3.7s, calculate empty prompt: 0.7s).

To create a public link, set `share=True` in `launch()`.
Startup time: 21.7s (prepare environment: 9.0s, import torch: 2.5s, import gradio: 0.6s, setup paths: 0.7s, initialize shared: 0.1s, other imports: 0.5s, load scripts: 2.3s, create ui: 1.1s, gradio launch: 4.2s, add APIs: 0.7s).
To load target model SDXL
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  9090.11181640625
[Memory Management] Model Memory (MB) =  4897.086494445801
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  3169.025321960449
Moving model(s) has taken 1.38 seconds
100%|██████████████████████████████████████████████████████████████████████████████████| 44/44 [00:23<00:00,  1.88it/s]
To load target model AutoencoderKL█████████████████████████████████████████████████████| 44/44 [00:22<00:00,  1.89it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  10918.29638671875
[Memory Management] Model Memory (MB) =  159.55708122253418
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  9734.739305496216
Moving model(s) has taken 2.76 seconds
Total progress: 100%|██████████████████████████████████████████████████████████████████| 44/44 [00:26<00:00,  1.68it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 44/44 [00:26<00:00,  1.89it/s]

Additional information

No response

altoiddealer commented 1 month ago

Personally, I need to switch back to main until this is resolved :>

Neeeeeeeed the PNG Info!

Panchovix commented 1 month ago

You're absolutely right, just tested and got the same error (with your data)

There are some modifications on the api but not much, so not sure if these affect this process directly https://github.com/Panchovix/stable-diffusion-webui-forge/commits/dev_upstream_a1111/modules/api/api.py

I think, maybe, that the schedulers may be breaking it. Gonna check.

Panchovix commented 1 month ago

@altoiddealer I have pushed a commit now that should fix it. https://github.com/Panchovix/stable-diffusion-webui-forge/commit/23ad0000a2aaa6ce7e4633adbd85f9084e9b4016 Can you try it and see how it goes?

altoiddealer commented 1 month ago

This did indeed resolve the issue!

I'm back 👯‍♂️ !