Skip to content

Commit c9a2cfd

Browse files
Merge branch 'master' into racecond_fix
2 parents 39541d7 + 5cd5a67 commit c9a2cfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3644
-8520
lines changed

.github/workflows/run_tests.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run basic features tests on CPU with empty SD model
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v3
13+
- name: Set up Python 3.10
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.10.6
17+
- uses: actions/cache@v3
18+
with:
19+
path: ~/.cache/pip
20+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
21+
restore-keys: ${{ runner.os }}-pip-
22+
- name: Run tests
23+
run: python launch.py --tests basic_features --no-half --disable-opt-split-attention --use-cpu all --skip-torch-cuda-test
24+
- name: Upload main app stdout-stderr
25+
uses: actions/upload-artifact@v3
26+
if: always()
27+
with:
28+
name: stdout-stderr
29+
path: |
30+
test/stdout.txt
31+
test/stderr.txt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
__pycache__
22
*.ckpt
3+
*.safetensors
34
*.pth
45
/ESRGAN/*
56
/SwinIR/*

CODEOWNERS

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
* @AUTOMATIC1111
2-
/localizations/ar_AR.json @xmodar @blackneoo
3-
/localizations/de_DE.json @LunixWasTaken
4-
/localizations/es_ES.json @innovaciones
5-
/localizations/fr_FR.json @tumbly
6-
/localizations/it_IT.json @EugenioBuffo
7-
/localizations/ja_JP.json @yuuki76
8-
/localizations/ko_KR.json @36DB
9-
/localizations/pt_BR.json @M-art-ucci
10-
/localizations/ru_RU.json @kabachuha
11-
/localizations/tr_TR.json @camenduru
12-
/localizations/zh_CN.json @dtlnor @bgluminous
13-
/localizations/zh_TW.json @benlisquare
2+
3+
# if you were managing a localization and were removed from this file, this is because
4+
# the intended way to do localizations now is via extensions. See:
5+
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions
6+
# Make a repo with your localization and since you are still listed as a collaborator
7+
# you can add it to the wiki page yourself. This change is because some people complained
8+
# the git commit log is cluttered with things unrelated to almost everyone and
9+
# because I believe this is the best overall for the project to handle localizations almost
10+
# entirely without my oversight.
11+
12+

README.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web
7070
- separate prompts using uppercase `AND`
7171
- also supports weights for prompts: `a cat :1.2 AND a dog AND a penguin :2.2`
7272
- No token limit for prompts (original stable diffusion lets you use up to 75 tokens)
73-
- DeepDanbooru integration, creates danbooru style tags for anime prompts (add --deepdanbooru to commandline args)
73+
- DeepDanbooru integration, creates danbooru style tags for anime prompts
7474
- [xformers](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers), major speed increase for select cards: (add --xformers to commandline args)
7575
- via extension: [History tab](https://github.com/yfszzx/stable-diffusion-webui-images-browser): view, direct and delete images conveniently within the UI
7676
- Generate forever option
@@ -84,26 +84,7 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web
8484
- API
8585
- Support for dedicated [inpainting model](https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion) by RunwayML.
8686
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
87-
88-
## Where are Aesthetic Gradients?!?!
89-
Aesthetic Gradients are now an extension. You can install it using git:
90-
91-
```commandline
92-
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients extensions/aesthetic-gradients
93-
```
94-
95-
After running this command, make sure that you have `aesthetic-gradients` dir in webui's `extensions` directory and restart
96-
the UI. The interface for Aesthetic Gradients should appear exactly the same as it was.
97-
98-
## Where is History/Image browser?!?!
99-
Image browser is now an extension. You can install it using git:
100-
101-
```commandline
102-
git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser extensions/images-browser
103-
```
104-
105-
After running this command, make sure that you have `images-browser` dir in webui's `extensions` directory and restart
106-
the UI. The interface for Image browser should appear exactly the same as it was.
87+
- [Stable Diffusion 2.0](https://github.com/Stability-AI/stablediffusion) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#stable-diffusion-20) for instructions
10788

10889
## Installation and Running
10990
Make sure the required [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) are met and follow the instructions available for both [NVidia](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs) (recommended) and [AMD](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-AMD-GPUs) GPUs.
@@ -155,14 +136,15 @@ The documentation was moved from this README over to the project's [wiki](https:
155136
- Swin2SR - https://github.com/mv-lab/swin2sr
156137
- LDSR - https://github.com/Hafiidz/latent-diffusion
157138
- Ideas for optimizations - https://github.com/basujindal/stable-diffusion
158-
- Doggettx - Cross Attention layer optimization - https://github.com/Doggettx/stable-diffusion, original idea for prompt editing.
159-
- InvokeAI, lstein - Cross Attention layer optimization - https://github.com/invoke-ai/InvokeAI (originally http://github.com/lstein/stable-diffusion)
160-
- Rinon Gal - Textual Inversion - https://github.com/rinongal/textual_inversion (we're not using his code, but we are using his ideas).
139+
- Cross Attention layer optimization - Doggettx - https://github.com/Doggettx/stable-diffusion, original idea for prompt editing.
140+
- Cross Attention layer optimization - InvokeAI, lstein - https://github.com/invoke-ai/InvokeAI (originally http://github.com/lstein/stable-diffusion)
141+
- Textual Inversion - Rinon Gal - https://github.com/rinongal/textual_inversion (we're not using his code, but we are using his ideas).
161142
- Idea for SD upscale - https://github.com/jquesnelle/txt2imghd
162143
- Noise generation for outpainting mk2 - https://github.com/parlance-zz/g-diffuser-bot
163144
- CLIP interrogator idea and borrowing some code - https://github.com/pharmapsychotic/clip-interrogator
164145
- Idea for Composable Diffusion - https://github.com/energy-based-model/Compositional-Visual-Generation-with-Composable-Diffusion-Models-PyTorch
165146
- xformers - https://github.com/facebookresearch/xformers
166147
- DeepDanbooru - interrogator for anime diffusers https://github.com/KichangKim/DeepDanbooru
148+
- Security advice - RyotaK
167149
- Initial Gradio script - posted on 4chan by an Anonymous user. Thank you Anonymous user.
168150
- (You)

javascript/edit-attention.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
addEventListener('keydown', (event) => {
22
let target = event.originalTarget || event.composedPath()[0];
3-
if (!target.hasAttribute("placeholder")) return;
4-
if (!target.placeholder.toLowerCase().includes("prompt")) return;
3+
if (!target.matches("#toprow textarea.gr-text-input[placeholder]")) return;
54
if (! (event.metaKey || event.ctrlKey)) return;
65

76

javascript/generationParams.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// attaches listeners to the txt2img and img2img galleries to update displayed generation param text when the image changes
2+
3+
let txt2img_gallery, img2img_gallery, modal = undefined;
4+
onUiUpdate(function(){
5+
if (!txt2img_gallery) {
6+
txt2img_gallery = attachGalleryListeners("txt2img")
7+
}
8+
if (!img2img_gallery) {
9+
img2img_gallery = attachGalleryListeners("img2img")
10+
}
11+
if (!modal) {
12+
modal = gradioApp().getElementById('lightboxModal')
13+
modalObserver.observe(modal, { attributes : true, attributeFilter : ['style'] });
14+
}
15+
});
16+
17+
let modalObserver = new MutationObserver(function(mutations) {
18+
mutations.forEach(function(mutationRecord) {
19+
let selectedTab = gradioApp().querySelector('#tabs div button.bg-white')?.innerText
20+
if (mutationRecord.target.style.display === 'none' && selectedTab === 'txt2img' || selectedTab === 'img2img')
21+
gradioApp().getElementById(selectedTab+"_generation_info_button").click()
22+
});
23+
});
24+
25+
function attachGalleryListeners(tab_name) {
26+
gallery = gradioApp().querySelector('#'+tab_name+'_gallery')
27+
gallery?.addEventListener('click', () => gradioApp().getElementById(tab_name+"_generation_info_button").click());
28+
gallery?.addEventListener('keydown', (e) => {
29+
if (e.keyCode == 37 || e.keyCode == 39) // left or right arrow
30+
gradioApp().getElementById(tab_name+"_generation_info_button").click()
31+
});
32+
return gallery;
33+
}

javascript/hints.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ titles = {
6262

6363
"Interrogate": "Reconstruct prompt from existing image and put it into the prompt field.",
6464

65-
"Images filename pattern": "Use following tags to define how filenames for images are chosen: [steps], [cfg], [prompt], [prompt_no_styles], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [datetime], [datetime<Format>], [datetime<Format><Time Zone>], [job_timestamp]; leave empty for default.",
66-
"Directory name pattern": "Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg], [prompt], [prompt_no_styles], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [datetime], [datetime<Format>], [datetime<Format><Time Zone>], [job_timestamp]; leave empty for default.",
65+
"Images filename pattern": "Use following tags to define how filenames for images are chosen: [steps], [cfg], [prompt], [prompt_no_styles], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [model_name], [prompt_words], [date], [datetime], [datetime<Format>], [datetime<Format><Time Zone>], [job_timestamp]; leave empty for default.",
66+
"Directory name pattern": "Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg], [prompt], [prompt_no_styles], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [model_name], [prompt_words], [date], [datetime], [datetime<Format>], [datetime<Format><Time Zone>], [job_timestamp]; leave empty for default.",
6767
"Max prompt words": "Set the maximum number of words to be used in the [prompt_words] option; ATTENTION: If the words are too long, they may exceed the maximum length of the file path that the system can handle",
6868

6969
"Loopback": "Process an image, use it as an input, repeat.",
@@ -94,6 +94,8 @@ titles = {
9494
"Add difference": "Result = A + (B - C) * M",
9595

9696
"Learning rate": "how fast should the training go. Low values will take longer to train, high values may fail to converge (not generate accurate results) and/or may break the embedding (This has happened if you see Loss: nan in the training info textbox. If this happens, you need to manually restore your embedding from an older not-broken backup).\n\nYou can set a single numeric value, or multiple learning rates using the syntax:\n\n rate_1:max_steps_1, rate_2:max_steps_2, ...\n\nEG: 0.005:100, 1e-3:1000, 1e-5\n\nWill train with rate of 0.005 for first 100 steps, then 1e-3 until 1000 steps, then 1e-5 for all remaining steps.",
97+
98+
"Clip skip": "Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc."
9799
}
98100

99101

javascript/progressbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip
2323

2424
if(opts.show_progress_in_title && progressbar && progressbar.offsetParent){
2525
if(progressbar.innerText){
26-
let newtitle = 'Stable Diffusion - ' + progressbar.innerText
26+
let newtitle = '[' + progressbar.innerText.trim() + '] Stable Diffusion';
2727
if(document.title != newtitle){
2828
document.title = newtitle;
2929
}

javascript/ui.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ function set_theme(theme){
88
}
99

1010
function selected_gallery_index(){
11-
var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem .gallery-item')
12-
var button = gradioApp().querySelector('[style="display: block;"].tabitem .gallery-item.\\!ring-2')
11+
var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item')
12+
var button = gradioApp().querySelector('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item.\\!ring-2')
1313

1414
var result = -1
1515
buttons.forEach(function(v, i){ if(v==button) { result = i } })
@@ -208,4 +208,6 @@ function update_token_counter(button_id) {
208208
function restart_reload(){
209209
document.body.innerHTML='<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>';
210210
setTimeout(function(){location.reload()},2000)
211+
212+
return []
211213
}

0 commit comments

Comments
 (0)