Commit Graph

655 Commits

Author SHA1 Message Date
c14bdcb8fd combine PRs #690 and #683 2022-09-19 13:59:43 -04:00
f816526d0d add ability to post-process images from the CLI
- supports gfpgan, esrgan, codeformer and embiggen
- To use:
   dream> !fix ./outputs/img-samples/000056.292144555.png -ft gfpgan -U2 -G0.8
   dream> !fix ./outputs/img-samples/000056.292144555.png -ft codeformer -G 0.8
   dream> !fix ./outputs/img-samples/000056.29214455.png  -U4
   dream> !fix ./outputs/img-samples/000056.292144555.png -embiggen 1.5

   The first example invokes gfpgan to fix faces and esrgan to upscale.
   The second example invokes codeformer to fix faces, no upscaling
   The third example uses esrgan to upscale 4X
   The four example runs embiggen to enlarge 1.5X

- This is very preliminary work. There are some anomalies to note:
  1. The syntax is non-obvious. I would prefer something like:
     !fix esrgan,gfpgan
     !fix esrgan
     !fix embiggen,codeformer

     However, this will require refactoring the gfpgan and embiggen
     code.

   2. Images generated using gfpgan, esrgan or codeformer all are named
      "xxxxxx.xxxxxx.postprocessed.png" and the original is saved.
      However, the prefix is a new one that is not related to the
      original.

   3. Images generated using embiggen are named "xxxxx.xxxxxxx.png",
      and once again the prefix is new. I'm not sure whether the
      prefix should be aligned with the original file's prefix or not.
      Probably not, but opinions welcome.
2022-09-19 12:38:14 -04:00
7b0cbb34d6 GFPGAN and Real ESRGAN Implementation Refactor 2022-09-19 23:38:56 +12:00
682d74754c Fixes metadata_loads() #686 2022-09-18 22:41:39 -04:00
6bf19cd897 Updating with evergreen Discord invite (#635)
* Update to add Adobe Photoshop Guide for inpainting (#617)

* updating with Adobe instructions & assets

* Assets for Adobe guide

* correcting paths

* update Readme with evergreen discord invite link

* discord image asset uploaded

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-18 21:30:21 -04:00
2743e17588 Fix token display when using -t
Add true weight used for subprompt
2022-09-18 21:25:27 -04:00
f0b500fba8 Fixes metadata implementation #686 2022-09-18 21:24:29 -04:00
aaec6baeca Add .gitkeep to the weights folder 2022-09-18 20:35:05 -04:00
1e8e5245eb CLI writes prompt string metadata in same format as web server 2022-09-18 15:08:56 -04:00
a0a9b12daf fix(scripts): dream.py typo (#675)
Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
2022-09-18 15:03:11 -04:00
f3292a6953 Implement CodeFormer Face Restoration (#669)
* Implement CodeFormer Face Restoration

* fix codeformer model destination path

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-18 15:01:05 -04:00
062f3e8f31 Gfpgan download fix (#655)
* restore ability to save files to directories named after prompt

* don't download gfpgan model file if it exists

- Fixes #647
2022-09-18 14:42:43 -04:00
3c4c4d71c9 VARIATIONS.md - fix typo in formatting (#664)
A beginning line for a code section was left out.
2022-09-18 09:50:54 -04:00
ea2b0828d8 Documentation for negative prompts (#668)
Documentation for pull lstein#661, and splits prompt docs into a separate file.
2022-09-18 09:50:19 -04:00
045aa7a9a3 Support color correction for img2img and inpainting (#613)
* Support color correction for img2img and inpainting, avoiding the shift to magenta seen when running images through img2img repeatedly.

* Fix docs for color correction

* add --init_color to prompt reconstruction

* For best results, the --init_color option should point to the *very first* image used in the sequence of img2img operations. Otherwise color correction will skew towards cyan.

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-18 09:47:57 -04:00
0a4397094e Negative / Unconditioned Prompts (#661)
Co-Authored-By: rabidcopy <8052832+rabidcopy@users.noreply.github.com>

Co-authored-by: rabidcopy <8052832+rabidcopy@users.noreply.github.com>
2022-09-18 09:08:30 -04:00
b68cb521ba restore ability to save files to directories named after prompt (#654) 2022-09-18 08:37:08 -04:00
9bcb0dff96 feat(docs): readme - add discord server badge/link (#644)
Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-17 18:28:26 -04:00
f84372efd8 fix(doc): readme - more meaningful CI links from badges (#645)
Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
2022-09-17 18:26:09 -04:00
071f65a892 Enable even larger images with one simple torch.nn.functional.silu import (#653)
Fixes:
File "stable-diffusion/ldm/modules/diffusionmodules/model.py", line 37, in nonlinearity
    return x*torch.sigmoid(x)
RuntimeError: CUDA out of memory. Tried to allocate 1.56 GiB [..]

Now up to 1536x1280 is possible on 8GB VRAM.
Also remove unused SiLU class.
2022-09-17 18:03:52 -04:00
ad292b095d minor fix to ldm.dream.args
- If no list of seeds is provided to metadata_dumps(), then the contents
of the Args object's seed attribute are used.
2022-09-17 13:44:39 -04:00
d8685ad66b Merge branch 'development' of github.com:lstein/stable-diffusion into development 2022-09-17 13:29:21 -04:00
239f41f3e0 add sd-metadata metadata_loads() and metadata_dumps() functions 2022-09-17 13:28:37 -04:00
e0951f28cf Refactor attention.CrossAttention to remove duplicate code and apply optimizations
Apply ~6% speedup by moving * self.scale to earlier on a smaller tensor.
When we have enough VRAM don't make a useless zeros tensor.
Switch between cuda/mps/cpu based on q.device.type to allow cleaner per architecture future optimizations.
For cuda and cpu keep VRAM usage and faster slicing consistent.
For cpu use smaller slices. Tested ~20% faster on i7, 9.8 to 7.7 s/it.
Fix = typo to self.mem_total >= 8 in einsum_op_mps_v2 as per #582 discussion.
2022-09-17 20:19:21 +03:00
100f2e8f57 toil(docs): readme - remove remaining markdown warts, HTML
Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
2022-09-17 13:00:37 -04:00
2faa116238 tidy up generation of prompt when variations in use 2022-09-17 11:59:47 -04:00
c94b8cd959 small bug fixes in prompt generation
- fixes no closing quote in pretty-printed dream_prompt string
- removes unecessary -f switch when txt2img used

In addition, this commit does an experimental commenting-out of the
random.seed() call in the variation-generating part of ldm.dream.generator.base.
This fixes the problem of two calls that use the same seed and -v0.1
generating different images (#641). However, it does not fix the issue
of two images generated using the same seed and -VXXXXXX being
different.
2022-09-17 10:18:55 -04:00
34fa6e38e7 fix long hex-encoded error message from legacy server
- closes issue #618
2022-09-17 08:39:20 -04:00
9461c8127d upgrade Pillow 2022-09-17 02:44:31 -04:00
b5ed668eff small legacy web appearance tweaks 2022-09-17 02:44:07 -04:00
b3e026aa4e point legacy web server at legacy static files 2022-09-17 02:18:52 -04:00
89540f293b Restored static files needed for new flask/react web server
WARNING: old web server will no longer display correct interface.
2022-09-17 02:01:55 -04:00
31daf1f0d7 preload_models.py now downloads gfpgan model 2022-09-17 01:32:31 -04:00
5b692f4720 include width and height in png dream prompt 2022-09-17 01:14:00 -04:00
b89aadb3c9 fix crash on second prompt #636 2022-09-17 00:57:35 -04:00
994c6b7512 Merge branch 'development' into bug-fixes 2022-09-16 23:08:02 -04:00
42072fc15c Bug Fixes 2022-09-17 14:12:35 +12:00
fefcdffb55 fix(readme): switch last-commit badge to last DEV commit (#626)
- switch badge service to badgen, as I couldn't figure out shields.io

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
2022-09-16 20:21:19 -04:00
61f46cac31 Merge branch 'development' of github.com:lstein/stable-diffusion into development 2022-09-16 19:59:17 -04:00
df4c80f177 respect --outdir again; fix issue #628 2022-09-16 19:58:45 -04:00
df95a7ddf2 respect --outdir again; fix issue #628 2022-09-16 19:58:16 -04:00
622db491b2 change tensor length to 768 per #572 2022-09-16 18:25:43 -04:00
37e2418ee0 Added linux to the workflows (#463)
* Added linux to the workflows

- rename workflow files

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

* fixes: run on merge to 'main', 'dev'; 

- reduce dev merge test cases to 1 (1 takes 11 minutes 😯)
- fix model cache name

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

* add test prompts to workflows

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
Co-authored-by: James Reynolds <magnsuviri@me.com>
Co-authored-by: Ben Alkov <ben.alkov@gmail.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-16 17:46:57 -04:00
40b61870f6 update Intel Mac instructions (#599)
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-16 17:42:21 -04:00
6cab2e0ca0 refine env rebuild tip (#611) 2022-09-16 17:32:52 -04:00
ba4892e03f Zero-pad intermediate image file names (#616) 2022-09-16 17:32:18 -04:00
6cb6c4a911 restore static files for old web server 2022-09-16 17:27:08 -04:00
fe12c6c099 Squashed commit of the following:
commit 67fbaa7c31
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Fri Sep 16 16:57:54 2022 -0400

    reconciled conflicting changes to pngwriter call

commit ddc68b01f7
Merge: f9feaac cbac95b
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date:   Sat Sep 17 06:39:22 2022 +1000

    Merge remote-tracking branch 'upstream/development' into development

commit f9feaac8c7
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date:   Sat Sep 17 06:16:16 2022 +1000

    Fixes metadata related to new args

commit d1de1e357a
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date:   Sat Sep 17 06:15:55 2022 +1000

    Fixes PromptFormatter import bug
2022-09-16 16:58:16 -04:00
cbac95b02a Merge with PR #602
- New and improved web api
- Author: @Kyle0654
2022-09-16 16:35:34 -04:00
00d2d0e90e Flask/React web server now merged, but needs fixes.
* due to changes in the metadata written to PNG files, web server cannot
display images
* issue is identified and will be fixed in next 24h
* Python 3.9 required for flask/react web server; environment must be
updated.
2022-09-16 14:54:19 -04:00