pkuliyi2015 / sd-webui-stablesr

StableSR for Stable Diffusion WebUI - Ultra High-quality Image Upscaler
https://iceclear.github.io/projects/stablesr/
Other
1.05k stars 54 forks source link

KeyError: '64' ? #11

Open cgdreamer opened 1 year ago

cgdreamer commented 1 year ago

我的webui版本现在是第18周的,但是运行会报KeyError: '64',3060Ti 8G,所有安装和设置都没有问题, 编码器图块尺寸(Encoder Tile Size):1536 解码器图块尺寸(Decoder Tile Size):96 ; 潜变量分块(Latent tile)宽度: 64,潜变量分块(Latent tile)高度:64,潜变量分块(Latent tile)重叠:32,潜变量分块(Latent tile)批处理规模:1,放大算法:None;

pkuliyi2015 commented 1 year ago

今天终于偶然发现了问题的原因。会修复。原因是在webui图生图放大模式那个地方不能选潜变量放大。

jasonxyan commented 1 year ago

今天终于偶然发现了问题的原因。会修复。原因是在webui图生图放大模式那个地方不能选潜变量放大。

指的是哪里?我没有使用潜变量放大也报 64 错误了……最新版本的 Web UI。

jasonxyan commented 1 year ago

今天终于偶然发现了问题的原因。会修复。原因是在webui图生图放大模式那个地方不能选潜变量放大。

指的是哪里?我没有使用潜变量放大也报 64 错误了……最新版本的 Web UI。

补充下,StableSR 的安装和配置都没有问题,但图生图 Tiled VAE 运行完就会报错。

WSJUSA commented 1 year ago

I also get the Key Error 64. Settings after the log below...

ultiDiffusion hooked into 'Euler a' sampler, Tile size: 64x64, Tile batches: 620, Batch size: 1. (ext: ContrlNet)?it/s] MultiDiffusion Sampling: 0%| | 0/6820 [00:17<?, ?it/s] [Tiled VAE]: input_size: torch.Size([1, 3, 8000, 5344]), tile_size: 512, padding: 32 [Tiled VAE]: split to 16x11 = 176 tiles. Optimal tile size 480x512, original tile size 512x512 [Tiled VAE]: Fast mode enabled, estimating group norm parameters on 342 x 512 image [Tiled VAE]: Executing Encoder Task Queue: 100%|████████████████████████████████| 16016/16016 [00:26<00:00, 614.04it/s] [Tiled VAE]: Done in 26.643s, max VRAM alloc 3694.912 MB 0%| | 0/11 [01:15<?, ?it/s] Error completing request Arguments: ('task(kh1atspnctbp46r)', 0, '', '', [], <PIL.Image.Image image mode=RGBA size=2672x4000 at 0x22F2DB63E80>, None, None, None, None, None, None, 20, 0, 4, 0, 1, False, False, 1, 1, 2, 1.5, 0.5, -1.0, -1.0, 0, 0, 0, False, 512, 512, 0, 0, 32, 0, '', '', '', [], 10, True, 'MultiDiffusion', False, True, 1024, 1024, 64, 64, 32, 1, 'None', 2, False, 10, 1, 1, 64, False, False, False, False, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, True, 512, 48, True, True, True, False, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x0000022F2DBA9CC0>, '

\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '

Will upscale the image by the selected scale factor; use width and height sliders to set tile size

', 32, 6, 2, 1, '', 0, '', 0, '', True, False, False, False, 0, None, None, False, 50, 'stablesr_webui_sd-v2-1-512-ema-000117.ckpt', 2, False, 'None', False, '

Will upscale the image depending on the selected target size type

', 512, 0, 8, 32, 64, 0.35, 32, 0, True, 0, False, 8, 0, 0, 2048, 2048, 2) {} Traceback (most recent call last): ... StabilityDiffusion\stable-diffusion-webui\extensions\sd-webui-stablesr\srmodule\spade.py", line 39, in _forward segmap = segmap_dic[str(x_dic.size(-1))] KeyError: '64'

I proof checked the Tiled Diffusion and Tiled VAE run without StableSR

Graphics card: NVIDIA GTX 2060 Super 8G Settings I use in A11111: --xformers --opt=channelslast --no-half-vae Checkpoint: v2-1_512-ema-pruined.ckpt [88ecb78256] Resize mode: Just resize CFG Scale: 2 Denoise: strength: 1 Latent tile batch size: 1 Move VAE to GPU: On Encoder Tile Size: 512 Decoder Tile Size: 48 SR Model: stablessr_webui_sd-v2-1-512-ema-000117.ckpt Color Fix: On /Off (tried both) Pure Noise: Off

Linxmotion commented 1 year ago

今天终于偶然发现了问题的原因。会修复。原因是在webui图生图放大模式那个地方不能选潜变量放大。 潜变量放大是说缩放模式第四个吗,我没开这个也是keyerror:64.我试了两个电脑,都是这样用的是秋叶包 image

WSJUSA commented 1 year ago

I dont really code much python, but it seems the expected segmap_dic object is empty, and it appears to me the 64 is a lookup that is failing. The 64 is whatever number is defined in the Tiled Diffusion - Latent tile dimension, specifically the width, which StableSR is checking first. If the value of the width is changed the "64" in the error changes with it.

image

liyuanshang commented 1 year ago

只启用 Tiled VAE,不启用Tiled Diffusion,就不会报错。放大效果是一样的

WSJUSA commented 1 year ago

只启用 Tiled VAE,不启用Tiled Diffusion,就不会报错。放大效果是一样的

Unfortunately without the Tile Diffusion i hit the CUDA out of Memory

mrmihaell commented 1 year ago

У меня тоже эта ошибка. Работает без Tiled Diffusion, но нет возможности сравнить результаты

WSJUSA commented 1 year ago

after a few weeks delay i am back to trying to get the tile diffusion + tiled vae + stableSR combination to work on a NVIDIA GeForce RTX 2060 SUPER with 16.0 GB RAM

using models:

  1. disabling Tiled Diffusion and Tiled VAE was able to 2x StableSD upscale alone, anything more than 2x tripped OOM -- fantastic results on 512x512 downscaled real world camera photo png export from photoshop.

  2. enabling Tiled VAE only, (disabled Tiled Diffusion) could upscale 4x with Tiled VEA settings of:

    • Encoder Tile Size 256
    • Decoder Tile Size 64

anything larger on the encoder decoder sizes and hit OOM

  1. Add in Tiled Diffusion and always error out on the segmap_dic input, seems like an array mismatch, as its always a KeyError of some value, sometimes its 96 from the TD latent tile size, or 24 with the smaller above settings on the VEA
    • Latent Tile width/height: 96
    • Latent Tile overlap: 48
    • Latent Tile Batch Size: 1

File "C:\Users\wjame\Documents\StabilityDiffusion\stable-diffusion-webui\extensions\sd-webui-stablesr\srmodule\spade.py", line 39, in _forward segmap = segmap_dic[str(x_dic.size(-1))] KeyError: '24'

I think I've hit the wall, nothing left to check that I can identify, just for the record tried the readme settings, which trips the KeyError 96

WSJUSA commented 1 year ago

Seems the KeyError for me went away when I upgraded automatic1111. Now the tile diffusion and vae work with stabilitysr.