diff --git a/.dev_scripts/test_regression_txt2img_dream_v1_4.sh b/.dev_scripts/test_regression_txt2img_dream_v1_4.sh index 11cbf8f14b..9326d3c311 100644 --- a/.dev_scripts/test_regression_txt2img_dream_v1_4.sh +++ b/.dev_scripts/test_regression_txt2img_dream_v1_4.sh @@ -5,8 +5,7 @@ SAMPLES_DIR=${OUT_DIR} python scripts/dream.py \ --from_file ${PROMPT_FILE} \ --outdir ${OUT_DIR} \ - --sampler plms \ - --full_precision + --sampler plms # original output by CompVis/stable-diffusion IMAGE1=".dev_scripts/images/v1_4_astronaut_rides_horse_plms_step50_seed42.png" diff --git a/.github/workflows/mkdocs-flow.yml b/.github/workflows/mkdocs-flow.yml new file mode 100644 index 0000000000..49a9cbd423 --- /dev/null +++ b/.github/workflows/mkdocs-flow.yml @@ -0,0 +1,28 @@ +name: Deploy +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + name: Deploy docs to GitHub Pages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Build + uses: Tiryoh/actions-mkdocs@v0 + with: + mkdocs_version: 'latest' # option + requirements: '/requirements-mkdocs.txt' # option + configfile: '/mkdocs.yml' # option + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site diff --git a/.github/workflows/test-dream-conda.yml b/.github/workflows/test-dream-conda.yml index 3bd9b24582..6c51ebe718 100644 --- a/.github/workflows/test-dream-conda.yml +++ b/.github/workflows/test-dream-conda.yml @@ -85,9 +85,9 @@ jobs: fi # Utterly hacky, but I don't know how else to do this if [[ ${{ github.ref }} == 'refs/heads/master' ]]; then - time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/preflight_prompts.txt --full_precision + time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/preflight_prompts.txt elif [[ ${{ github.ref }} == 'refs/heads/development' ]]; then - time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/dev_prompts.txt --full_precision + time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/dev_prompts.txt fi mkdir -p outputs/img-samples - name: Archive results diff --git a/.gitignore b/.gitignore index df1e55ee6d..da74df3a1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # ignore default image save location and model symbolic link outputs/ models/ldm/stable-diffusion-v1/model.ckpt +ldm/dream/restoration/codeformer/weights + +# ignore the Anaconda/Miniconda installer used while building Docker image +anaconda.sh # ignore a directory which serves as a place for initial images inputs/ @@ -77,9 +81,6 @@ db.sqlite3-journal instance/ .webassets-cache -# WebUI temp files: -img2img-tmp.png - # Scrapy stuff: .scrapy @@ -186,3 +187,12 @@ testtube checkpoints # If it's a Mac .DS_Store + +# Let the frontend manage its own gitignore +!frontend/* + +# Scratch folder +.scratch/ +.vscode/ +gfpgan/ +models/ldm/stable-diffusion-v1/model.sha256 diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 0000000000..ce4b99a07b --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,13 @@ +endOfLine: lf +tabWidth: 2 +useTabs: false +singleQuote: true +quoteProps: as-needed +embeddedLanguageFormatting: auto +overrides: + - files: '*.md' + options: + proseWrap: always + printWidth: 80 + parser: markdown + cursorOffset: -1 diff --git a/README.md b/README.md index 4eb9374b51..b61b365774 100644 --- a/README.md +++ b/README.md @@ -1,165 +1,190 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
---
## Step 2 - Generating Variations
-Let's try to generate some variations. Using the same seed, we pass the argument `-v0.1` (or --variant_amount), which generates a series of
-variations each differing by a variation amount of 0.2. This number ranges from `0` to `1.0`, with higher numbers being larger amounts of
-variation.
+Let's try to generate some variations. Using the same seed, we pass the argument
+`-v0.1` (or --variant_amount), which generates a series of variations each
+differing by a variation amount of 0.2. This number ranges from `0` to `1.0`,
+with higher numbers being larger amounts of variation.
-```
+```bash
dream> "prompt" -n6 -S3357757885 -v0.2
...
Outputs:
@@ -60,33 +70,42 @@ Outputs:
### **Variation Sub Seeding**
-Note that the output for each image has a `-V` option giving the "variant subseed" for that image, consisting of a seed followed by the
-variation amount used to generate it.
+Note that the output for each image has a `-V` option giving the "variant
+subseed" for that image, consisting of a seed followed by the variation amount
+used to generate it.
-This gives us a series of closely-related variations, including the two shown here.
+This gives us a series of closely-related variations, including the two shown
+here.
-
-
+
-I like the expression on Xena's face in the first one (subseed 3647897225), and the armor on her shoulder in the second one (subseed 1614299449). Can we combine them to get the best of both worlds?
+
-We combine the two variations using `-V` (--with_variations). Again, we must provide the seed for the originally-chosen image in order for
-this to work.
+I like the expression on Xena's face in the first one (subseed 3647897225), and
+the armor on her shoulder in the second one (subseed 1614299449). Can we combine
+them to get the best of both worlds?
-```
-dream> "prompt" -S3357757885 -V3647897225,0.1;1614299449,0.1
+We combine the two variations using `-V` (`--with_variations`). Again, we must
+provide the seed for the originally-chosen image in order for this to work.
+
+```bash
+dream> "prompt" -S3357757885 -V3647897225,0.1,1614299449,0.1
Outputs:
./outputs/Xena/000003.1614299449.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 3647897225:0.1,1614299449:0.1 -S3357757885
```
-Here we are providing equal weights (0.1 and 0.1) for both the subseeds. The resulting image is close, but not exactly what I wanted:
+Here we are providing equal weights (0.1 and 0.1) for both the subseeds. The
+resulting image is close, but not exactly what I wanted:
-
+
-We could either try combining the images with different weights, or we can generate more variations around the almost-but-not-quite image. We do the latter, using both the `-V` (combining) and `-v` (variation strength) options. Note that we use `-n6` to generate 6 variations:
+We could either try combining the images with different weights, or we can
+generate more variations around the almost-but-not-quite image. We do the
+latter, using both the `-V` (combining) and `-v` (variation strength) options.
+Note that we use `-n6` to generate 6 variations:
-```
-dream> "prompt" -S3357757885 -V3647897225,0.1;1614299449,0.1 -v0.05 -n6
+```bash
+dream> "prompt" -S3357757885 -V3647897225,0.1,1614299449,0.1 -v0.05 -n6
Outputs:
./outputs/Xena/000004.3279757577.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 3647897225:0.1,1614299449:0.1,3279757577:0.05 -S3357757885
./outputs/Xena/000004.2853129515.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 3647897225:0.1,1614299449:0.1,2853129515:0.05 -S3357757885
@@ -96,9 +115,11 @@ Outputs:
./outputs/Xena/000004.2183375608.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 3647897225:0.1,1614299449:0.1,2183375608:0.05 -S3357757885
```
-This produces six images, all slight variations on the combination of the chosen two images. Here's the one I like best:
+This produces six images, all slight variations on the combination of the chosen
+two images. Here's the one I like best:
-
+
-As you can see, this is a very powerful tool, which when combined with subprompt weighting, gives you great control over the content and
-quality of your generated images.
+As you can see, this is a very powerful tool, which when combined with subprompt
+weighting, gives you great control over the content and quality of your
+generated images.
diff --git a/docs/features/WEB.md b/docs/features/WEB.md
index 9eb6aa5bfc..833b18cdfc 100644
--- a/docs/features/WEB.md
+++ b/docs/features/WEB.md
@@ -1,13 +1,21 @@
-# Barebones Web Server
+---
+title: Barebones Web Server
+---
-As of version 1.10, this distribution comes with a bare bones web server (see screenshot). To use it, run the `dream.py` script by adding the `**--web**` option.
+# :material-web: Barebones Web Server
-```
+As of version 1.10, this distribution comes with a bare bones web server (see
+screenshot). To use it, run the `dream.py` script by adding the `--web`
+option.
+
+```bash
(ldm) ~/stable-diffusion$ python3 scripts/dream.py --web
```
-You can then connect to the server by pointing your web browser at http://localhost:9090, or to the network name or IP address of the server.
+You can then connect to the server by pointing your web browser at
+http://localhost:9090, or to the network name or IP address of the server.
-Kudos to [Tesseract Cat](https://github.com/TesseractCat) for contributing this code, and to [dagf2101](https://github.com/dagf2101) for refining it.
+Kudos to [Tesseract Cat](https://github.com/TesseractCat) for contributing this
+code, and to [dagf2101](https://github.com/dagf2101) for refining it.

diff --git a/docs/help/TROUBLESHOOT.md b/docs/help/TROUBLESHOOT.md
index cac5dddf23..f5dcfe2c1c 100644
--- a/docs/help/TROUBLESHOOT.md
+++ b/docs/help/TROUBLESHOOT.md
@@ -1,68 +1,91 @@
-# **Frequently Asked Questions**
+---
+title: F.A.Q.
+---
-Here are a few common installation problems and their solutions. Often these are caused by incomplete installations or crashes during the
-install process.
+# :material-frequently-asked-questions: F.A.Q.
+
+## **Frequently-Asked-Questions**
+
+Here are a few common installation problems and their solutions. Often these are caused by
+incomplete installations or crashes during the install process.
---
-**QUESTION**
+### **QUESTION**
During `conda env create -f environment.yaml`, conda hangs indefinitely.
-**SOLUTION**
+### **SOLUTION**
-Enter the stable-diffusion directory and completely remove the `src` directory and all its contents. The safest way to do this is to enter the stable-diffusion directory and give the command `git clean -f`. If this still doesn't fix the problem, try "conda clean -all" and then restart at the `conda env create` step.
+Enter the stable-diffusion directory and completely remove the `src` directory and all its contents.
+The safest way to do this is to enter the stable-diffusion directory and give the command
+`git clean -f`. If this still doesn't fix the problem, try "conda clean -all" and then restart at
+the `conda env create` step.
---
-**QUESTION**
+### **QUESTION**
-`dream.py` crashes with the complaint that it can't find `ldm.simplet2i.py`. Or it complains that function is being passed incorrect parameters.
+`dream.py` crashes with the complaint that it can't find `ldm.simplet2i.py`. Or it complains that
+function is being passed incorrect parameters.
-**SOLUTION**
+### **SOLUTION**
-Reinstall the stable diffusion modules. Enter the `stable-diffusion` directory and give the command `pip install -e .`
+Reinstall the stable diffusion modules. Enter the `stable-diffusion` directory and give the command
+`pip install -e .`
---
-**QUESTION**
+### **QUESTION**
`dream.py` dies, complaining of various missing modules, none of which starts with `ldm``.
-**SOLUTION**
+### **SOLUTION**
-From within the `stable-diffusion` directory, run `conda env update -f environment.yaml` This is also frequently the solution to
-complaints about an unknown function in a module.
+From within the `stable-diffusion` directory, run `conda env update -f environment.yaml` This is
+also frequently the solution to complaints about an unknown function in a module.
---
-**QUESTION**
+### **QUESTION**
There's a feature or bugfix in the Stable Diffusion GitHub that you want to try out.
-**SOLUTION**
+### **SOLUTION**
-**Main Branch**
+#### **Main Branch**
-If the fix/feature is on the `main` branch, enter the stable-diffusion directory and do a `git pull`.
+If the fix/feature is on the `main` branch, enter the stable-diffusion directory and do a
+`git pull`.
-Usually this will be sufficient, but if you start to see errors about missing or incorrect modules, use the command `pip install -e .` and/or `conda env update -f environment.yaml` (These commands won't break anything.)
+Usually this will be sufficient, but if you start to see errors about missing or incorrect modules,
+use the command
-**Sub Branch**
+`pip install -e .` and/or
-If the feature/fix is on a branch (e.g. "_foo-bugfix_"), the recipe is similar, but do a `git pull >16&255,u[c++]=t>>8&255,u[c++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,a=[],i=16383,s=0,l=n-o;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var o,a,i=[],s=t;ss&&(r=s-l),a=r;a>=0;a--){let r=!0;for(let n=0;n>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return x(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function O(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o