Giter Site home page Giter Site logo

automatic1111 / stable-diffusion-webui Goto Github PK

View Code? Open in Web Editor NEW
127.0K 1.0K 24.7K 34.33 MB

Stable Diffusion web UI

License: GNU Affero General Public License v3.0

Python 86.90% CSS 2.23% JavaScript 8.79% Batchfile 0.13% Shell 0.63% HTML 1.32%
deep-learning diffusion image-generation image2image img2img text2image txt2img ai ai-art gradio

stable-diffusion-webui's Introduction

Stable Diffusion web UI

A web interface for Stable Diffusion, implemented using Gradio library.

Features

Detailed feature showcase with images:

  • Original txt2img and img2img modes
  • One click install and run script (but you still must install python and git)
  • Outpainting
  • Inpainting
  • Color Sketch
  • Prompt Matrix
  • Stable Diffusion Upscale
  • Attention, specify parts of text that the model should pay more attention to
    • a man in a ((tuxedo)) - will pay more attention to tuxedo
    • a man in a (tuxedo:1.21) - alternative syntax
    • select text and press Ctrl+Up or Ctrl+Down (or Command+Up or Command+Down if you're on a MacOS) to automatically adjust attention to selected text (code contributed by anonymous user)
  • Loopback, run img2img processing multiple times
  • X/Y/Z plot, a way to draw a 3 dimensional plot of images with different parameters
  • Textual Inversion
    • have as many embeddings as you want and use any names you like for them
    • use multiple embeddings with different numbers of vectors per token
    • works with half precision floating point numbers
    • train embeddings on 8GB (also reports of 6GB working)
  • Extras tab with:
    • GFPGAN, neural network that fixes faces
    • CodeFormer, face restoration tool as an alternative to GFPGAN
    • RealESRGAN, neural network upscaler
    • ESRGAN, neural network upscaler with a lot of third party models
    • SwinIR and Swin2SR (see here), neural network upscalers
    • LDSR, Latent diffusion super resolution upscaling
  • Resizing aspect ratio options
  • Sampling method selection
    • Adjust sampler eta values (noise multiplier)
    • More advanced noise setting options
  • Interrupt processing at any time
  • 4GB video card support (also reports of 2GB working)
  • Correct seeds for batches
  • Live prompt token length validation
  • Generation parameters
    • parameters you used to generate images are saved with that image
    • in PNG chunks for PNG, in EXIF for JPEG
    • can drag the image to PNG info tab to restore generation parameters and automatically copy them into UI
    • can be disabled in settings
    • drag and drop an image/text-parameters to promptbox
  • Read Generation Parameters Button, loads parameters in promptbox to UI
  • Settings page
  • Running arbitrary python code from UI (must run with --allow-code to enable)
  • Mouseover hints for most UI elements
  • Possible to change defaults/mix/max/step values for UI elements via text config
  • Tiling support, a checkbox to create images that can be tiled like textures
  • Progress bar and live image generation preview
    • Can use a separate neural network to produce previews with almost none VRAM or compute requirement
  • Negative prompt, an extra text field that allows you to list what you don't want to see in generated image
  • Styles, a way to save part of prompt and easily apply them via dropdown later
  • Variations, a way to generate same image but with tiny differences
  • Seed resizing, a way to generate same image but at slightly different resolution
  • CLIP interrogator, a button that tries to guess prompt from an image
  • Prompt Editing, a way to change prompt mid-generation, say to start making a watermelon and switch to anime girl midway
  • Batch Processing, process a group of files using img2img
  • Img2img Alternative, reverse Euler method of cross attention control
  • Highres Fix, a convenience option to produce high resolution pictures in one click without usual distortions
  • Reloading checkpoints on the fly
  • Checkpoint Merger, a tab that allows you to merge up to 3 checkpoints into one
  • Custom scripts with many extensions from community
  • Composable-Diffusion, a way to use multiple prompts at once
    • separate prompts using uppercase AND
    • also supports weights for prompts: a cat :1.2 AND a dog AND a penguin :2.2
  • No token limit for prompts (original stable diffusion lets you use up to 75 tokens)
  • DeepDanbooru integration, creates danbooru style tags for anime prompts
  • xformers, major speed increase for select cards: (add --xformers to commandline args)
  • via extension: History tab: view, direct and delete images conveniently within the UI
  • Generate forever option
  • Training tab
    • hypernetworks and embeddings options
    • Preprocessing images: cropping, mirroring, autotagging using BLIP or deepdanbooru (for anime)
  • Clip skip
  • Hypernetworks
  • Loras (same as Hypernetworks but more pretty)
  • A separate UI where you can choose, with preview, which embeddings, hypernetworks or Loras to add to your prompt
  • Can select to load a different VAE from settings screen
  • Estimated completion time in progress bar
  • API
  • Support for dedicated inpainting model by RunwayML
  • via extension: Aesthetic Gradients, a way to generate images with a specific aesthetic by using clip images embeds (implementation of https://github.com/vicgalle/stable-diffusion-aesthetic-gradients)
  • Stable Diffusion 2.0 support - see wiki for instructions
  • Alt-Diffusion support - see wiki for instructions
  • Now without any bad letters!
  • Load checkpoints in safetensors format
  • Eased resolution restriction: generated image's dimensions must be a multiple of 8 rather than 64
  • Now with a license!
  • Reorder elements in the UI from settings screen
  • Segmind Stable Diffusion support

Installation and Running

Make sure the required dependencies are met and follow the instructions available for:

Alternatively, use online services (like Google Colab):

Installation on Windows 10/11 with NVidia-GPUs using release package

  1. Download sd.webui.zip from v1.0.0-pre and extract its contents.
  2. Run update.bat.
  3. Run run.bat.

For more details see Install-and-Run-on-NVidia-GPUs

Automatic Installation on Windows

  1. Install Python 3.10.6 (Newer version of Python does not support torch), checking "Add Python to PATH".
  2. Install git.
  3. Download the stable-diffusion-webui repository, for example by running git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git.
  4. Run webui-user.bat from Windows Explorer as normal, non-administrator, user.

Automatic Installation on Linux

  1. Install the dependencies:
# Debian-based:
sudo apt install wget git python3 python3-venv libgl1 libglib2.0-0
# Red Hat-based:
sudo dnf install wget git python3 gperftools-libs libglvnd-glx 
# openSUSE-based:
sudo zypper install wget git python3 libtcmalloc4 libglvnd
# Arch-based:
sudo pacman -S wget git python3
  1. Navigate to the directory you would like the webui to be installed and execute the following command:
wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
  1. Run webui.sh.
  2. Check webui-user.sh for options.

Installation on Apple Silicon

Find the instructions here.

Contributing

Here's how to add code to this repo: Contributing

Documentation

The documentation was moved from this README over to the project's wiki.

For the purposes of getting Google and other search engines to crawl the wiki, here's a link to the (not for humans) crawlable wiki.

Credits

Licenses for borrowed code can be found in Settings -> Licenses screen, and also in html/licenses.html file.

stable-diffusion-webui's People

Contributors

36db avatar akx avatar aria1th avatar automatic1111 avatar batvbs avatar brkirch avatar c43h66n12o12s2 avatar catboxanon avatar codehatchling avatar d8ahazard avatar daswer123 avatar dfaker avatar discus0434 avatar dtlnor avatar ellangok avatar kohakublueleaf avatar mezotaken avatar missionfloyd avatar papuspartan avatar r-n avatar random-thoughtss avatar sakura-luna avatar sj-si avatar space-nuko avatar timntorres avatar v0xie avatar vladmandic avatar w-e-w avatar wfjsw avatar yfszzx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stable-diffusion-webui's Issues

FileNotFoundError when trying to save images

Trying to save images using the "save" button gives FileNotFoundError: [Errno 2] No such file or directory: 'log/log.csv'

cmd writes Traceback (most recent call last):
File "C:\Users\admin\stable-diffusion-webui\modules\ui.py", line 116, in f
res = list(func(*args, **kwargs))
File "C:\Users\admin\stable-diffusion-webui\modules\ui.py", line 87, in save_files
with open("log/log.csv", "a", encoding="utf8", newline='') as file:
FileNotFoundError: [Errno 2] No such file or directory: 'log/log.csv'

image

I'm using customized save directory but everything was working fine yesterday, the only difference is after the new install today I customized them without generating anything first, I also unchecked every other autosaving settings (girds & images) so it only saves single images when I choose to, hope these details help.

structure changed bigtime, errors incoming

I really dont want to do the bat thing and destroy my current env, also i dont want to make another one cause i had it working few dayus ago along with 3 other uis/ SD projects
So here it goes

To create a public link, set share=True in launch().
Loaded a total of 10 text inversion embeddings.
Error completing request
Arguments: ('photo of hem', None, None, 20, 6, 4, 0, False, 0, 1, 1, 7, 0.75, -1.0, 512, 512, 0, 'RealESRGAN', 64, True,
0, 0, '', False, 0, '', 1, '') {}
Traceback (most recent call last):
File "D:\stabot\stable-diffusion\webui\modules\ui.py", line 116, in f
res = list(func(*args, **kwargs))
File "webui.py", line 106, in f
res = func(*args, **kwargs)
File "D:\stabot\stable-diffusion\webui\modules\img2img.py", line 136, in img2img
processed = process_images(p)
File "D:\stabot\stable-diffusion\webui\modules\processing.py", line 148, in process_images
p.init()
File "D:\stabot\stable-diffusion\webui\modules\processing.py", line 331, in init
image = img.convert("RGB")
AttributeError: 'NoneType' object has no attribute 'convert'

anything new i should pip installl since repo from 2 days ago ?

embedding code

can you add adefiniable path to embedding checkpoints so we can use finetuned models ?

python scripts/txt2img.py --ddim_eta 0.0
--n_samples 8
--n_iter 2
--scale 10.0
--ddim_steps 50
--embedding_path /path/to/logs/trained_model/checkpoints/embeddings_gs-5049.pt
--ckpt_path /path/to/pretrained/model.ckpt
--prompt "a photo of *

i tried to place model.embedding_manager.load(opt.embedding_path) in original gui script but no success, it errors out when i prompt - newthing*

Its from this inversion repository to finetune weights
https://github.com/nicolai256/Stable-textual-inversion_win

Msked content fill or original is the same

When masking a person for example and setting to "original", instead of generating only the background (not the masked area) it just generates the mask area (like fill)
so basically both fill and original do the same thing, which is generate masked area

Buttons on UI to load previous /next image file from folder , in img2img tab and upscalers tab.

Its pretty overwhelming after awhile when we have thousands of generated images and we load one by one to upscale seeking for particular ones,
So i think it would really help if there would be some kind of button on UI that loads next file and another button that loads previous file ( so two buttons next to each other), and we wouldnt have to open file browser for hundreds of times and scrol through files with mouse wheel.
After loading first image file we would just use buttons/arrows to move between images in given folder, it woud speedup upscaling workflow and img2img workflow quite alot, generations of images are stacking up pretty quickly.

Performance regression in image2image

Using the default image, same settings (I think?), and the following prompt:
A fantasy landscape
Steps: 50, Sampler: k-diffusion, CFG scale: 7, Seed: 2057480064

It takes 8 seconds to generate on my RTX 3060 Ti for this version of the script.
before

But it takes several magnitudes longer with the latest version?
after

It's normal? keeps hanging here since like 6 min...

Screenshot_2

Screenshot_3

I have anaconda installed too.

๐Ÿ‘‰ The SRC folder don't exist when you download this repo, so i created it and follow this instructions:

GFPGAN

If you want to use GFPGAN to improve generated faces, you need to install it separately. Download [GFPGANv1.3.pth](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth) and put it into the /stable-diffusion/src/gfpgan/experiments/pretrained_models directory.

RealESRGAN

Download [RealESRGAN_x4plus.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth) and [RealESRGAN_x4plus_anime_6B.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth). Put them into the stable-diffusion/src/realesrgan/experiments/pretrained_models directory.

OS: Win. 10 x64.

blending for esrgan like its currently for gfpgan

All is working well but i was wondering can you incorporate esrgan blending with original ? So we can move slider like with gfpgan and it would blend two images (original preupscale+pastupscale ran through esrgan)
With bicubic or lanczos upscale blended with esrgan.Can a slider affect it in realtime in preview window? S you just render gfpgan at full strength and you blend with original one by moving the slider, so you dont have to resynthesize with gfpgan everytime you want less strength, it will save gpu , i believe this effect can be done by simply blending two images with opacity/blend of upscaled one adjustable in real time over original image.
I assume you blend gfpgan with original one upscaled by lanczos ? Would this work in realtime tho ? So you would upscale with gfpgan and then move slider to alter how strong the blend should be and it would affect the image in realtime ?
I belive gfpgan should be last step so esrgan wouldnt try to upscale the face on top of it., at the moment i think realsrgan sits on top of gfpgan and is upscaling the face making it look artificial again, thats why i think it should be below gfpgan in the pipeline.Face should look as natural as possible
The styles ccan vary so much that you might only need just a tiny bit of upscale with gfpgan or realsrgan to get best result while on other cases you can go to the max, such process would benefit strongly from realtime preview. But maybe it would need separate "blend" slider and not just renamed strength?

For basic sharpening maybe this would be useful with slider ?
https://www.analyticsvidhya.com/blog/2021/08/sharpening-an-image-using-opencv-library-in-python/#:~:text=To%20sharpen%20an%20image%20in,image%20that%20will%20undergo%20sharpening.
So ther would be 3 sharpening/upscaling methods on one panel ( realsrgan layer, filter2d layer, and face restoration layer )controled by blending sliders

Loopback takes original photo for all generations

Instead of taking the last generated imaged and slowly turn init_pic into my prompt, its just gives me 15 variations of the init_img slightly changed.
Is that a known bug ? havent seen it mentioned

img2img SD upscale gives out 512 output

I think SD upscaling is now limited to 1024 output,, would be nice to have options for higher res, even tho im not really sure if there will be a benefit.Just a suggestion.

img2img SD upscale correct settings

I can't understand which settings (prompt, seed, sampling steps, etc.) should be used for img2img SD upscale.
Can you please describe how to correctly use it, I'm getting very strange results using it?
I would be highly appreciated
Thanks for your amazing work!

Ability to turn off esrgan when upscaling with SD img2img

I did a test, changed esrgan to regular lanczos upscale and it preserved details better than esrgan so...
Id like to be able to turn it off or on, i have a placeholder code to turn it off but i realy think people would benefit more from regular lanczos upscale + another slider for sharpening filter from pillow.
esrgan just takes away too much fine detail and texture especially from classic oil paintings

The pipeline - lanczos upscale - sharpen - sd upscale , eventually another sharpen on top of sd upscale at the very end , but that can be done somewhere else if it would clutter the code too much , i also add very fine noise before final sharpening to get extra fine texture.... but thats just my workflow, in the end it want other people to get most detail possible, esrgan just kills with some styles it unfortunately.
Also from tests the best samples for finetune detail is DPM2 Ancestral, it does 2 passess, is it possible to get one with 3 passess or hey even more ?

errors... inpainting and img2img , dispaying pixel size of rectangular marquee when scaling it

Hi are there any plans to add inpainting tab ?
Also when i scale marquee to crop image then im not sure if i have perfect square, displaying pixel size would help with it
Ok heres issues i have/errors--

1when i want to get less steps i cant slide the slider, i have to click , very strange, original ui version works fine... ok looks like that one fixed itself.

2 iimg2img panel is broken , complains about - pil image has no attribute resampling, i looked it up, pillow 9 should of fix it, so i pipd it and its still broken... it works fine in original version of that gui.

ValueError when using inpaint with inpaint at full resolution option

Currently the inpaint for img2img conversion is not working on my end. It seems like the mask is not working as intended / is not applied at all. My current PIL version is Name: Pillow, Version: 9.2.0 and the current Numpy version is Name: numpy Version: 1.23.2.
The 4-tuple crop_reagion leading to this error is (448, 448, 64, 64).

Error:

Traceback (most recent call last):
  File "----\webui.py", line 690, in f
    res = list(func(*args, **kwargs))
  File "----\webui.py", line 678, in f
    res = func(*args, **kwargs)
  File "----\webui.py", line 1689, in img2img
    processed = process_images(p)
  File "----\webui.py", line 1146, in process_images
    p.init()
  File "----\webui.py", line 1494, in init
    mask = mask.crop(crop_region)
  File "----\anaconda3\lib\site-packages\PIL\Image.py", line 1171, in crop
    raise ValueError("Coordinate 'right' is less than 'left'")
ValueError: Coordinate 'right' is less than 'left'

Image to demonstrate the error:
image

Further, disabling inpaint at full resolution leads to interference and an output, but the output image is exactly the same as the input image, as if the mask was never applied.

[Feature Request] SD upscale in txt2img mode

would be nice to have it in there as well.

And even better - would be cool if we could automate the whole process. As in: first have the image go through the SD upscale, and then through the ESRGAN upscale automatically.

Attribute error when using embeddings

I am getting an error when embeddings exist.

  File "webui.py", line 516, in forward
    z = outputs.last_hidden_state
AttributeError: 'Tensor' object has no attribute 'last_hidden_state'

Otherwise the python script works perfectly fine when the embeddings directory does not exist.

scripting sampler test?

image

I'm attempting to modify the sampler/scale script to make something that outputs the example image above, but it's crashing when I try to run it.

For the few it does work on, it's unclear which sampler is which, would anyone be able to help please? -

steps = [20,40,80,120,240]
sampler_index= [4,5,6,7]

def cell(x, y, p=p):
	p.steps = x
	p.sampler_index = y
	return process_images(p).images[0]

images = [draw_xy_grid(
	xs = steps,
	ys = sampler_index,
	x_label = lambda x: f'Steps = {x}',
	y_label = lambda y: f'CFG = {y}',
	cell = cell
)]

save_image(images[0], 'test/gnomeplot', 'gnome6')
display(images)

embedding pt file doesnt work

I finetuned the face of stallone but my pt file just does not get detected in webui like my other pt files, this one is bigger at 153kb, others that work are 6kb, it was finetuned at 256 res and samples looked very promising
Any way to get it working ? Yeh its actual output from SD , not a real photo
samples_scaled_gs-006500_e-000004_b-000500_00000066

Here is the file
embeddings_gs-14499.zip

Failed to establish a new connection: [Errno 11004] getaddrinfo failed'

I followed this tutorial https://rentry.org/kretard from top to bottom, I wrote a simple bat file in the main folder, in order to launch Stable quickly, But the very same error always popos out

the code is as followed:

call %userprofile%\miniconda3\Scripts\activate.bat ldx
python "scripts\webgui.py"
cmd /k

the error msg after it run is as followed:

(ldx) E:\SD>python "scripts\webgui.py"
Loaded GFPGAN
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\gradio\utils.py:47: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(latest_pkg_version) > StrictVersion(current_pkg_version):
C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\gradio\utils.py:47: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(latest_pkg_version) > StrictVersion(current_pkg_version):
Traceback (most recent call last):
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\util\connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Users\charl\miniconda3\envs\ldx\lib\socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000022CD69F4670>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000022CD69F4670>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts\webgui.py", line 464, in <module>
    gr.Image(value="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg", source="upload", interactive=True, type="pil"),
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\gradio\components.py", line 1451, in __init__
    self.value = self.postprocess(initial_value)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\gradio\components.py", line 1732, in postprocess
    out_y = processing_utils.encode_url_or_file_to_base64(y)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\gradio\processing_utils.py", line 35, in encode_url_or_file_to_base64
    requests.get(path)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\charl\miniconda3\envs\ldx\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000022CD69F4670>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))

If I tried to launch it just using anaconda and manually type in the code it will be fine
Can you show me the light please kind sir. Thank you so much. I am a total noob in programming

Embeddings won't load

Thank you for this repo!

Is there an issue with embeddings right now? They were working for yesterday (and still work with hlky's UI) but give this error now:

Error loading emedding Usada.pt:
Traceback (most recent call last):
  File "stable-diffusion-webui/webui.py", line 745, in load_textual_inversion_embeddings
    process_file(os.path.join(dirname, fn), fn)
  File "stable-diffusion-webui/webui.py", line 731, in process_file
    assert len(param_dict) == 1, 'embedding file has multiple terms in it'
  File "/root/miniconda3/envs/ui/lib/python3.8/site-packages/torch/nn/modules/container.py", line 623, in __len__
    return len(self._keys)
  File "/root/miniconda3/envs/ui/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'ParameterDict' object has no attribute '_keys'

Feature Request: txt2img advanced toggle for outputing every sampling step

Wondering if you would be able to add a toggle in the advanced tab of the txt2img generator that would cause it to output the image at each sampling step. I noticed that when using certain sampling methods mostly euler_a and dpm2_a they can change the image quite dramatically between sampling steps.

Right now I am just manually incrementing the sampling number and regenerating the image for each sampling step. Which seems like a huge waste since for each next step I am having to reprocess all of the preceding step.

Failing to properly install through webui.bat

Currently installed torch: 1.10.2+cu113
Pip version: 21.3.1

WebUI reports I'm 'using pip version 18.1 but 21.3.1 is available'. I attempted to edit the webUI.bat to see if I could get it to run with 1.10.2+cu113 but it fails in base_command::143 in main (status = self.run(options, args).

I have CUDA installed and am running an nVidia GTX 1070 6GB. If I run the webUI batch normally it returns (exit code 1)
stderr:
Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.0+cu113, 1.10.1, 1.10.1+cu113, 1.10.2, 1.10.2+cu113)
No matching distribution found for torch==1.12.1+cu113.

Python is at the recommended version. OS is Win10 [64bit]

flips out cause theres no gfpgan and other stuff

todays version throws an error it cant find model where it should be and wont start without gfpgan and tells me i dont have other stuff even tho i did not changed anything from yesterday , also hlky repo works totally fine .
Not sure what it looks for at D:\configs\stable-diffusion\v1-inference.yaml'

Warning: Stable Diffusion not found at path D:\ldm
Warning: Taming Transformers not found at path D:\taming-transformers\taming
Error setting up GFPGAN:
Traceback (most recent call last):
File "webui.py", line 155, in
model_path = gfpgan_model_path()
File "webui.py", line 144, in gfpgan_model_path
raise Exception("GFPGAN model not found in paths: " + ", ".join(files))
Exception: GFPGAN model not found in paths: GFPGANv1.3.pth, D:\stabot\GFPGANv1.3.pth, .\GFPGANv1.3.pth, ./GFPGAN\experiments/pretrained_models\GFPGANv1.3.pth

Traceback (most recent call last):
File "webui.py", line 1669, in
sd_config = OmegaConf.load(cmd_opts.config)
File "C:\Users\BAZO\miniconda3\envs\ldm\lib\site-packages\omegaconf\omegaconf.py", line 183, in load
with io.open(os.path.abspath(file_), "r", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\configs\stable-diffusion\v1-inference.yaml'

GFPGAN causes VRAM leak with batches

With GFPGAN activated, large batches fail. Likely related to #9 .

On my GTX 1080, VRAM leaks 500 MB per image, and continues to rise until it runs out of VRAM. This behavior is consistent throughout runs.

As the behavior is still happening, PR #11 does not seem to fix it.

Edit: it it synced to master

better API?

Hi,
first congrats - this is amazing project!

Are there any plans to change "predict/" API to a more versatile one which can be easier used by other applications? I mean changing to objects and key/value instead of indexed-array. It is just CSV - most terrible choice.
Thank you!

Runtime error

RuntimeError: CUDA error: unknown error
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

Any ideas

Fill cropped picture

Would an option to give a small cropped init_pic and let SD generate the missing parts to get a big picture from it?

Share not working right

Hi!

I did a fresh install of SD from the official repo and then added this package. When I ran it localhost works fine, but when I tried to access the gradio.app url it doesn't work. It loads, but none of the jobs ever start processing.

Proposal to make latent noise/latent zeros more useful, outpainting possibilities

if self.mask is not None:

I've been playing with this piece of code a bit to try to do outpainting, and it seems like if you remove these lines and move the following to the end of init() (just above)

if self.mask is not None:
    if self.inpainting_fill == 2:
        # noise fill initial masked region of initial latent space
        self.init_latent = self.init_latent * self.mask + create_random_tensors(self.init_latent.shape[1:], [self.seed + x + 1 for x in range(self.init_latent.shape[0])]) * self.nmask
    elif self.inpainting_fill == 3:
        # zero fill initial masked region of initial latent space
        self.init_latent = self.init_latent * self.mask

Latent zeros and latent noise become a lot more useful. I'm not familiar enough with ML or this model/architecture to say for certain, but I don't think it makes sense to mask out the noise at every sample step.

Pre change (fill with latent zeros, just a black bar at the bottom):
image

Post change (fill with latent zeros):
(shifted up 64px and masked in inpainting mode, Euler, denoising = 1, original seed)
image

(shifted up 128px and masked, Euler, denoising = 1)
image

(shifted up 256px and masked, Euler, denoising = 1)
image

A 2nd pass with img2img sort of helped but it looks like it interpreted the seam as a relevant feature (might not be a problem with more explicit and defined prompts, like humans or something):
Before:
image

After:
image

I think a decent outpainting mode could look like what SD upscale does, but allow the window to hang off the image by some configurable amount and apply a mask to that gap region, then go over the whole thing in a 2nd pass with img2img (possibly with a light contrast selective pre-blur to cover the seam) to clean it up.

Fix faces using GFPGAN + high batch count tends to fail 6GB VRAM

6GB is already on a knife's edge, and this seems to push it over. However it doesn't do it every single time, and I have not seen it happen when using batch count 1, even when hitting submit repeatedly.

RuntimeError: CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 6.00 GiB total capacity; 3.30 GiB already allocated; 0 bytes free; 4.60 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Adding k_euler and k_euler_a to gui ?

Hey these produce best results on low numbers quickly so maybe adding them would be a good idea ?
You have results on bottom of this guide , looks like ddim and both k_eulers got best quality pretty quickly with 8 steps on k_euler so slightly better than ddim which is second best.
https://rentry.org/GUItard

[Feature Request] manual iterative sectional outpainting

https://www.youtube.com/watch?v=N913hReVxMM

I think it works pretty well but i wouldnt implement it like he did (on small 512 image and synthesizing whole image)

What i would do is open a big image and start to synthesize by moving a window with adjustable size 512x512 lets say and mask things i want to apply inpainting to, this way we can work on huge images and fill them up with a lot of generated windos at various sizes .
Well, basically something like this would be better approach , scaling the window and synthesizing on small parts is a good way to save gpu cycles and time .
https://twitter.com/EMostaque/status/1555245665676132353?s=20&t=rVGevPHhk5hHooQWA-S1sw
A moveable window, not sure if thats possible in gradio.

Inpainting mask blur edge

It works great with inpainting but i noticed that it blurs out not the actual real image edge outwards+inwards but the inpainted part which is the opposite of what should happen
New inpainted stuff inside the mask should not be burred practically at all at the edges towards and outwards the edge line , and blur out real image revaling inpainted stuff underneath instead using fading of opacity/alpha channel with more and more pixels the more you push the slider to the bigger values.
Cause now no matter what i do the hard edge of orignal image remains on top of the inpainted stuff.

--medvram OOMs

My video card is GTX 1650 4GB and I am running the script with

python stable-diffusion-webui/webui.py --medvram --precision full --no-half

I have noticed that the new --medvram option is not equivalent to the old --lowvram option. In this new implementation, I am unable to generate txt2img with 512x512 or 448x448 resolutions like I could before.

If you need me to run any specific tests, please let me know.

Images not saving.

Image Directories not created automatically and nothing saving into /log when I click save.

Inpainting mode to cleanup bigger pictures

Can there be inpanting mode when you upload an image of the beach which is quite big and you pan it around to inpaint people on it to remove them and you can save whole image at the end ? So basically like this tool - https://cleanup.pictures/

You can inpaint stuff one by one, and the mask will disappear automatically once inpainting is done and you can work on other parts by masking out sfuff of the image again and again
So you would work on updated image and it would not resynthesize the same region twice unless you mask it yourself
Im just not sure if the main model is capable of that workflow to detect whats around like lama code in cleanup pictures
If that wont work then maybe incorporating LAMA into the gui would make more sense ? I used this one on a lot of the images , its self hosted version of the cleanup pictures website
https://github.com/Sanster/lama-cleaner

If the generation takes too long there's an error

If the generation takes too long ( and by too long seems to be about 30 seconds ) there's an error :
image

Here's the request that goes in error
image

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "Firefox",
      "version": "104.0.1"
    },
    "browser": {
      "name": "Firefox",
      "version": "104.0.1"
    },
    "pages": [
      {
        "startedDateTime": "2022-09-04T00:19:56.758+02:00",
        "id": "page_1",
        "title": "Gradio",
        "pageTimings": {
          "onContentLoad": -6310759,
          "onLoad": -6301258
        }
      }
    ],
    "entries": [
      {
        "pageref": "page_1",
        "startedDateTime": "2022-09-04T00:19:56.758+02:00",
        "request": {
          "bodySize": 0,
          "method": "POST",
          "url": "http://127.0.0.1:7860/api/predict/",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "127.0.0.1:7860"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Referer",
              "value": "http://127.0.0.1:7860/"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Content-Length",
              "value": "271"
            },
            {
              "name": "Origin",
              "value": "http://127.0.0.1:7860"
            },
            {
              "name": "DNT",
              "value": "1"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "same-origin"
            }
          ],
          "cookies": [],
          "queryString": [],
          "headersSize": null
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0
      }
    ]
  }
}

I dont know if you need anything else, I'm here in case you need it

Thank you

FileNotFoundError after new update

Getting a FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\admin\stable-diffusion-webui\scripts' after the new update.

Not exactly good at all the coding stuff, using it just fine yesterday but I downloaded the repo instead of git clone, for the sake of easier update I started a new installation by git cloning into user folder and the installation went well but ran into this while launching through webui.py.

Python 3.10.6
venv C:\Users\admin\stable-diffusion-webui\venv\Scripts\Python.exe
Launching webui.py...
Loading model from C:\Users\admin\stable-diffusion-webui\model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
File "C:\Users\admin\stable-diffusion-webui\webui.py", line 135, in
modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
File "C:\Users\admin\stable-diffusion-webui\modules\scripts.py", line 32, in load_scripts
for filename in os.listdir(basedir):
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\admin\stable-diffusion-webui\scripts'

Neither installation works

Using both the automatic and manual installations are giving me error "ImportError: cannot import name 'autocast' from 'torch'".
The torch module that I have installed is '1.9.0+cu111'.

Suggestion: Show images as soon as they are created

Not sure if this is a limitation of Gradio but i think it would be nice to be able to see the pictures that have already been created when a batch is ready. So one does not have to wait for all to be done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.