Commit Graph

683 Commits

Author SHA1 Message Date
Lincoln Stein
5dd9e30c2f Merge branch 'development' of github.com:invoke-ai/InvokeAI into development 2022-10-04 22:58:09 -04:00
Lincoln Stein
f368f682e1 remove unecessary import of pyreadline3 2022-10-04 22:53:07 -04:00
Lincoln Stein
d16f0c8a8f add enhancements to CLI command-line completion and history
- Added support for pyreadline3 so that Window users can benefit.
- Added the !search command to search the history for a matching string:
~~~
!search puppies
[20] puppies at the food bowl -Ak_lms
[54] house overrun by hungry puppies -C20 -s100
~~~
- Added the !clear command to clear the in-memory and on-disk
  command history.
2022-10-04 22:53:07 -04:00
Lincoln Stein
18e667f98e fix miscellaneous regressions:
- embiggen needs to use ddim sampler due to low step count
- --hires_fix option needs to be written to log and command string
- fix call signature of _init_image_mask()
2022-10-04 22:48:19 -04:00
Lincoln Stein
a09c64a1fe merge outcropping and postprocessing fixes 2022-10-04 22:47:21 -04:00
Lincoln Stein
4c482fe24a refactor how postprocessors work
- similar call structures for outpainting, outcropping and face restoration modules
- added documentation for outcropping
- post-processing steps now leave a provenance chain (of sorts) in the sd-metadata field:

~~~
scripts/sd-metadata.py outputs/img-samples/curly.942491079.upscale.png
outputs/img-samples/curly.942491079.upscale.png:
 {
    "model": "stable diffusion",
    "model_id": "stable-diffusion-1.4",
    "model_hash": "fe4efff1e174c627256e44ec2991ba279b3816e364b49f9be2abc0b3ff3f8556",
    "app_id": "lstein/stable-diffusion",
    "app_version": "v1.15",
    "image": {
        "height": 512,
        "width": 512,
        "steps": 50,
        "cfg_scale": 7.5,
        "seed": 942491079,
        "prompt": [
            {
                "prompt": "pretty curly-haired redhead woman",
                "weight": 1.0
            }
        ],
        "postprocessing": [
            {
                "tool": "outcrop",
                "dream_command": "!fix \"test-pictures/curly.png\" -s 50 -S 942491079 -W 512 -H 512 -C 7.5 -A k_lms -c top 64 right 64"
            },
            {
                "tool": "gfpgan",
                "dream_command": "!fix \"outputs/img-samples/curly.942491079.outcrop-02.png\" -s 50 -S 942491079 -W 512 -H 512 -C 7.5 -A k_lms -G 0.8"
            },
            {
                "tool": "upscale",
                "dream_command": "!fix \"outputs/img-samples/curly.942491079.gfpgan.png\" -s 50 -S 942491079 -W 512 -H 512 -C 7.5 -A k_lms -U 4.0 0.75"
            }
        ],
        "sampler": "k_lms",
        "variations": [],
        "type": "txt2img"
    }
}
~~~
2022-10-04 22:37:25 -04:00
Lincoln Stein
609983ffa8 add outcrop postprocessor 2022-10-04 22:37:25 -04:00
Lincoln Stein
0f9bff66bc Merge branch 'development' of github.com:pbaylies/stable-diffusion into pbaylies-development 2022-10-04 22:31:11 -04:00
Peter Baylies
5d911b43c0
Merge branch 'development' into development 2022-10-04 18:40:42 -04:00
Lincoln Stein
483097f31c fix off-by-one error 2022-10-05 00:15:47 +02:00
Lincoln Stein
7a3eae4572 revert to original k* noise schedule 2022-10-05 00:15:47 +02:00
Peter Baylies
db349aa3ce * Fix meshgrid warning for perlin noise. 2022-10-04 16:58:22 -04:00
Peter Baylies
b5c114c5b7 * Changes for PR 2022-10-04 14:37:32 -04:00
Lincoln Stein
f34279b3e7 add perlin options to formatted dream cmd 2022-10-04 14:32:18 -04:00
Peter Baylies
f041510659
Merge branch 'development' into development 2022-10-03 23:53:19 -04:00
Lincoln Stein
feb405f19a reorder mask creation and scaling to avoid deleting colors under transparency 2022-10-03 23:29:09 -04:00
blessedcoolant
b8e4c13746 Add New WebUI and Desktop Mode
Co-Authored-By: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2022-10-03 23:28:53 -04:00
Lincoln Stein
0a217b5f15 Merge branch 'Any-Winter-4079-Textual_Inversion' of github.com:Any-Winter-4079/InvokeAI into development 2022-10-03 19:43:46 -04:00
psychedelicious
88a9f33422 Fixes #875 2022-10-03 19:42:12 -04:00
Lincoln Stein
ea67040ef1 restore behavior of --grid argument 2022-10-03 17:09:48 -04:00
Peter Baylies
e79069a957
Merge branch 'development' into development 2022-10-03 08:33:44 -04:00
Lincoln Stein
1ab09e7a06 use right value for step arg in img_callback in decode() 2022-10-03 05:47:32 -04:00
Lincoln Stein
7c6dbcb14a use right value for step arg in img_callback 2022-10-03 05:46:23 -04:00
Lincoln Stein
8e97bc24a4 restore step argument to step_callback 2022-10-03 05:38:43 -04:00
ArDiouscuros
935a9d3c75 Update !fetch command, add documentation and autocomplete list
-- !fetch takes second optional argument name of the file to save commands to
2022-10-03 10:38:22 +02:00
Lincoln Stein
5a88be3744 fix typo which caused crash in sampler.py 2022-10-02 22:31:11 -04:00
psychedelicious
8ba5e385ec Fixes #877 2022-10-02 16:55:23 -04:00
Lincoln Stein
a0f4af087c restore use of sampler.decode() in img2img 2022-10-02 14:58:21 -04:00
Lincoln Stein
958d7650dd img2img works with all samplers, inpainting working with ddim & plms
- img2img confirmed working with all samplers
- inpainting working on ddim & plms. Changes to k-diffusion
  module seem to be needed for inpainting support.
- switched k-diffuser noise schedule to original karras schedule,
  which reduces the step number needed for good results
2022-10-02 14:58:21 -04:00
Peter Baylies
e246e7c8b9
Merge branch 'development' into development 2022-10-01 19:26:46 -04:00
Lincoln Stein
1a0cf1320b improve behavior and fix bugs in CLI history handling and completion
-if readline.set_auto_history() is not implemented, as in pyreadline3, will fall
back gracefully to automatic history saving. The only issue with this is that
-!history commands will be recorded in the history.
-!fetch on missing file no longer crashes script
-!history is now one of the autocomplete commands
-.dream_history now stored in output directory rather than ~user directory.

An important limitation of the last feature is that the history is
loaded and saved to the .dream_history file in the --outdir directory
specified at script launch time. It is not swapped around when the
--outdir is changed during the session.
2022-10-01 15:24:04 -04:00
Lincoln Stein
fe28c5fbdc add documentation 2022-10-01 15:21:57 -04:00
ArDiouscuros
a626533cd4 Hi res mode fix duplicates with img2img scaling
Add message about interpolation size

Fix crash if sampler not set to DDIM, change parameter name to hires_fix

Hi res mode fix duplicates with img2img scaling
2022-10-01 11:56:59 +02:00
Peter Baylies
22b290daad
Merge branch 'development' into development 2022-09-30 17:14:34 -04:00
Lincoln Stein
6197f81ba0 improve behavior and fix bugs in CLI history handling and completion
-if readline.set_auto_history() is not implemented, as in pyreadline3, will fall
back gracefully to automatic history saving. The only issue with this is that
-!history commands will be recorded in the history.
-!fetch on missing file no longer crashes script
-!history is now one of the autocomplete commands
-.dream_history now stored in output directory rather than ~user directory.

An important limitation of the last feature is that the history is
loaded and saved to the .dream_history file in the --outdir directory
specified at script launch time. It is not swapped around when the
--outdir is changed during the session.
2022-09-30 16:09:38 -04:00
Peter Baylies
b09491ec45
Merge branch 'development' into development 2022-09-29 17:38:26 -04:00
Lincoln Stein
8c9f2ae705 fix duplicate files created during upscaling/facial reconstruction
- When --save_orig *not* provided during image generation with
  upscaling/face fixing, an extra image file was being created. This
  PR fixes the problem.

- Also generalizes the tab autocomplete for image paths such that
  autocomplete searches the output directory for all path-modifying
  options except for --outdir.
2022-09-29 17:29:04 -04:00
Peter Baylies
d3a4311c3d * Counteract recent bit-rot and churn negatively affecting my PR, as per feedback. 2022-09-28 19:47:36 -04:00
Lincoln Stein
b947290801
Merge branch 'development' into development 2022-09-28 17:35:30 -04:00
Lincoln Stein
6b56d45d85 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development 2022-09-28 15:09:10 -04:00
Lincoln Stein
5f4bca0147 make CLI help text shorter to improve readability 2022-09-28 14:56:52 -04:00
Lincoln Stein
98271a0267 fix crash that occurs in write_log when user interrupts generation with ^C 2022-09-28 14:56:52 -04:00
Lincoln Stein
743342816b add documentation and bug fixes
- normalized how filenames are written out when postprocessing invoked
- various fixes of bugs encountered during testing
- updated documentation
- updated help text
2022-09-28 14:56:51 -04:00
Lincoln Stein
fe00a8c05c implement history viewing & replaying in CLI
- Enhance tab completion functionality
- Each of the switches that read a filepath (e.g. --init_img) will trigger file path completion. The
  -S switch will display a list of recently-used seeds.
- Added new !fetch command to retrieve the metadata from a previously-generated image and populate the
  readline linebuffer with the appropriate editable command to regenerate.
- Added new !history command to display previous commands and reload them for modification.
- The !fetch and !fix commands both autocomplete *and* search automatically through the current
  outdir for files.
- The completer maintains a list of recently used seeds and will try to autocomplete them.
2022-09-28 14:56:27 -04:00
blessedcoolant
acc5199f85 Integrate New WebUI with dream.py 2022-09-28 14:55:37 -04:00
Lincoln Stein
6e4dc229e2 remove dangling debug statement 2022-09-28 14:55:37 -04:00
Lincoln Stein
6e54f504e7
Merge branch 'development' into webui-integration 2022-09-28 14:21:00 -04:00
Lincoln Stein
f93963cd6b make CLI help text shorter to improve readability 2022-09-28 14:20:12 -04:00
Lincoln Stein
e49e83e944 fix crash that occurs in write_log when user interrupts generation with ^C 2022-09-28 14:20:12 -04:00
Lincoln Stein
dff4850a82 add documentation and bug fixes
- normalized how filenames are written out when postprocessing invoked
- various fixes of bugs encountered during testing
- updated documentation
- updated help text
2022-09-28 14:20:12 -04:00
Lincoln Stein
800f9615c2 implement history viewing & replaying in CLI
- Enhance tab completion functionality
- Each of the switches that read a filepath (e.g. --init_img) will trigger file path completion. The
  -S switch will display a list of recently-used seeds.
- Added new !fetch command to retrieve the metadata from a previously-generated image and populate the
  readline linebuffer with the appropriate editable command to regenerate.
- Added new !history command to display previous commands and reload them for modification.
- The !fetch and !fix commands both autocomplete *and* search automatically through the current
  outdir for files.
- The completer maintains a list of recently used seeds and will try to autocomplete them.
2022-09-28 14:20:12 -04:00
Peter Baylies
29336387be
Merge branch 'development' into development 2022-09-28 08:16:42 -04:00
blessedcoolant
af8383c770 Integrate New WebUI with dream.py 2022-09-28 16:06:41 +13:00
Lincoln Stein
3491a1688b Merge branch 'development' of github.com:invoke-ai/InvokeAI into development 2022-09-27 18:15:14 -04:00
Lincoln Stein
ac1999929f remove dangling debug statement 2022-09-27 18:13:45 -04:00
Any-Winter-4079
e19aab4a9b Textual Inversion for M1
Update main.py

Update ddpm.py

Update personalized.py

Update personalized_style.py

Update v1-finetune.yaml

Update environment-mac.yaml

Rename v1-finetune.yaml to v1-m1-finetune.yaml

Create v1-finetune.yaml

Update main.py

Update main.py

Update environment-mac.yaml

Update v1-inference.yaml
2022-09-27 01:39:17 +02:00
Peter Baylies
be99d5a4bd
Merge branch 'development' into development 2022-09-26 09:21:15 -04:00
Lincoln Stein
14616f4178 make metadata retrieval more robust to changes in storage format
- args.py will now attempt to return a metadata-containing Args
  object using the following methods:

1. By looking for the 'sd-metadata' tag in the PNG info
2. By looking from the 'Dream' tag
3. As a last resort, fetch the seed from the filename and assume
   defaults for all other options.
2022-09-26 04:18:23 -04:00
blessedcoolant
d80fff70f2 ESRGAN Improvements 2022-09-26 03:28:23 -04:00
Lincoln Stein
d63897fc39 tweaks to get embiggen to work with new development changes PR #553
- swapped out calls to choose_autocast()
- fixed call to retrieve_png_metadata() so as to recover original prompt

Original author: @travco
2022-09-26 03:25:26 -04:00
Lincoln Stein
fdf6a542bf
Merge branch 'development' into main 2022-09-26 02:26:13 -04:00
ArDiouscuros
485fe67c92 Add workaround low memory crash during image saving
Sample model moved to cpu before processing samples to image
2022-09-26 02:15:51 -04:00
Peter Baylies
47408bb568
Merge branch 'development' into development 2022-09-24 22:11:18 -04:00
David Burnett
636c356aaf facexlib and codeformer are broken on mps currently, force CPU device. 2022-09-24 21:22:24 +02:00
Mihail Dumitrescu
66dac1884b Fix Generate.sample_to_image crash.
Build the base generator in same place and way as other generators to reduce the chance of missed arguments in the future.
Fixes crash with display in-progress images, though note the feature still doesn't work for other reasons.
2022-09-24 05:20:28 -04:00
blessedcoolant
b1d1063a25 Fix CodeFormer not working if GFPGAN is enabeld 2022-09-24 05:19:07 -04:00
Lincoln Stein
0678b24ebb
Merge branch 'development' into fix-empty-prompt-exception 2022-09-24 05:12:57 -04:00
blessedcoolant
53b4c3cc60 Upgrade GFPGAN to Version 1.4 2022-09-24 05:09:45 -04:00
Kyle Lacy
d117d23469 Fix exception when inpainting with DDIM sampler 2022-09-24 05:02:02 -04:00
Lincoln Stein
16a06ba66e fix typo 2022-09-24 05:00:57 -04:00
Kyle Lacy
6858c14d94 Allow Generate to take images as readers or Image instances 2022-09-24 05:00:57 -04:00
Lincoln Stein
bf21a0bf02 fix resizing of inpainting mask
- change image resampling method for mask shrinkage to prevent
  artifacts at edge of mask

Addresses #625
2022-09-24 04:37:34 -04:00
Peter Baylies
880142708d
Merge branch 'development' into development 2022-09-23 15:41:06 -04:00
Lincoln Stein
e69aa94800
Merge branch 'development' into fix-empty-prompt-exception 2022-09-23 13:18:02 +02:00
blessedcoolant
cd8be1d0e9 Restoration Modules are now optional 2022-09-23 10:51:41 +02:00
unknown
413064cf45 Web stub for first_seed argument per b93f04e 2022-09-23 09:38:32 +02:00
Lincoln Stein
40b3d07900
Merge branch 'development' into fix-empty-prompt-exception 2022-09-23 09:36:15 +02:00
Kyle Lacy
5f22a72188
Fix division by zero when using an empty prompt 2022-09-22 17:15:28 -07:00
Peter Baylies
88e3b6d310
Merge branch 'development' into development 2022-09-21 17:47:14 -04:00
Lincoln Stein
0ab5f2159d fix img2img incorrectly loading previous prompt 2022-09-21 15:18:59 -04:00
Lincoln Stein
bdbc76fcd4 Merged two different attempts to create __init__.py 2022-09-21 11:34:53 -04:00
Lincoln Stein
110c4f70df fix module loading errors
1. Add ldm/dream/restoration/__init__.py file that was inadvertently not
   committed earlier.
2. Add '.' to sys.path to address weird mac problem reported in #723
2022-09-21 11:31:15 -04:00
Peter Baylies
883b2b6e62 Merge branch 'development' of https://github.com/pbaylies/stable-diffusion into development 2022-09-21 11:05:34 -04:00
Peter Baylies
9903ce60f0
Merge branch 'development' into development 2022-09-21 11:05:20 -04:00
blessedcoolant
069f91f930 Bug Fix Patch 2022-09-21 10:07:43 -04:00
Peter Baylies
6142cf25cc * Bug fixes 2022-09-21 09:12:32 -04:00
Peter Baylies
60f0090786
Merge branch 'development' into development 2022-09-21 03:10:49 -04:00
Lincoln Stein
2cf294e6de Add outpainting functionality.
- Adapted from PR #489, author Dominic Letz [https://github.com/dominicletz]
- Too many upstream changes to merge, so frankensteined it in.
- Added support for !fix syntax
- Added documentation
2022-09-21 02:44:46 -04:00
Lincoln Stein
b93f04ee38 fix normalized prompt when a variation is generated
- The seed printed needs to be the one generated prior to the
  initial noising operation. To do this, I added a new "first_seed"
  argument to the image callback in dream.py.
- Closes #641
2022-09-21 00:32:29 -04:00
Lincoln Stein
0632a3a2ea remove dangling debugging statement 2022-09-21 00:06:16 -04:00
Lincoln Stein
8731b498c0 fix merge conflicts 2022-09-20 23:55:57 -04:00
Lincoln Stein
f408ef2e6c resolved multiple conflicts between PR #683 and subsequent PRs 2022-09-20 23:41:43 -04:00
Lincoln Stein
283a0d72c7 tweaks to make postprocess fixing work better
- modify strength of embiggen to reduce tiling ghosts
- normalize naming of postprocessed files (could improve more to avoid
name collisions)
- move restoration modules under ldm.dream
2022-09-20 23:38:04 -04:00
Lincoln Stein
cd69d258aa combine PRs #690 and #683 2022-09-20 23:38:03 -04:00
blessedcoolant
1b5013ab72 GFPGAN and Real ESRGAN Implementation Refactor 2022-09-20 23:37:19 -04:00
Lincoln Stein
e8bb39370c 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-20 23:33:20 -04:00
Lincoln Stein
fc61ddab3c
Merge branch 'development' into postprocessing-commands 2022-09-20 18:48:42 -04:00
Peter Baylies
d5209965bc
Merge branch 'development' into development 2022-09-20 17:40:21 -04:00
Mihail Dumitrescu
d176fb07cd Replace --full_precision with --precision that works even if not specified
Allowed values are 'auto', 'float32', 'autocast', 'float16'. If not specified or 'auto' a working precision is automatically selected based on the torch device.
Context: #526
Deprecated --full_precision / -F

Tested on both cuda and cpu by calling scripts/dream.py without arguments and checked the auto configuration worked. With --precision=auto/float32/autocast/float16 it performs as expected, either working or failing with a reasonable error. Also checked Img2Img.
2022-09-20 17:08:00 -04:00
冯不游
e02bfd00a8 create ldm.dream.log 2022-09-20 16:54:50 -04:00
Peter Baylies
90d8f0af73 Merge branch 'development' of https://github.com/lstein/stable-diffusion into development 2022-09-20 16:32:00 -04:00
psychedelicious
5f8f2e63eb Merge remote-tracking branch 'upstream/development' into development 2022-09-20 07:27:32 +10:00
Peter Baylies
8c72da3643 Merge remote-tracking branch 'upstream/development' into development 2022-09-19 15:48:22 -04:00
Lincoln Stein
23af057e5c tweaks to make postprocess fixing work better
- modify strength of embiggen to reduce tiling ghosts
- normalize naming of postprocessed files (could improve more to avoid
name collisions)
- move restoration modules under ldm.dream
2022-09-19 14:54:52 -04:00
Lincoln Stein
c14bdcb8fd combine PRs #690 and #683 2022-09-19 13:59:43 -04:00
Lincoln Stein
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
psychedelicious
57577401bd Fixes metadata_loads() #686 2022-09-19 12:33:45 -04:00
Lincoln Stein
58c63fe339 Merge branch 'development' of github.com:psychedelicious/stable-diffusion into psychedelicious-development 2022-09-19 12:27:42 -04:00
blessedcoolant
7b0cbb34d6 GFPGAN and Real ESRGAN Implementation Refactor 2022-09-19 23:38:56 +12:00
Peter Baylies
37c44ced1d
Merge branch 'development' into development 2022-09-19 07:22:03 -04:00
psychedelicious
2a6999d500 Fixes various issues with metadata handling 2022-09-19 17:38:56 +10:00
psychedelicious
682d74754c Fixes metadata_loads() #686 2022-09-18 22:41:39 -04:00
Peter Baylies
dc024845cf
Merge branch 'development' into development 2022-09-18 22:34:00 -04:00
psychedelicious
94ca13c494 Fixes metadata_loads() #686 2022-09-19 12:33:37 +10:00
Bernard Maltais
2743e17588 Fix token display when using -t
Add true weight used for subprompt
2022-09-18 21:25:27 -04:00
psychedelicious
f0b500fba8 Fixes metadata implementation #686 2022-09-18 21:24:29 -04:00
blessedcoolant
aaec6baeca Add .gitkeep to the weights folder 2022-09-18 20:35:05 -04:00
Peter Baylies
3692f223e1
Merge branch 'development' into development 2022-09-18 18:58:04 -04:00
Lincoln Stein
1e8e5245eb CLI writes prompt string metadata in same format as web server 2022-09-18 15:08:56 -04:00
blessedcoolant
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
Peter Baylies
c98ade9b25
Merge branch 'development' into development 2022-09-18 12:35:28 -04:00
Danny Beer
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
Peter Baylies
d478a241a8
Merge branch 'development' into development 2022-09-18 09:20:13 -04:00
blessedcoolant
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
Peter Baylies
0b786f61cc
Merge branch 'development' into development 2022-09-18 08:54:22 -04:00
Lincoln Stein
b68cb521ba
restore ability to save files to directories named after prompt (#654) 2022-09-18 08:37:08 -04:00
Peter Baylies
2f93418095
Merge branch 'development' into development 2022-09-17 20:35:48 -04:00
Mihai
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
Lincoln Stein
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
Lincoln Stein
d8685ad66b Merge branch 'development' of github.com:lstein/stable-diffusion into development 2022-09-17 13:29:21 -04:00
Lincoln Stein
239f41f3e0 add sd-metadata metadata_loads() and metadata_dumps() functions 2022-09-17 13:28:37 -04:00
Mihail Dumitrescu
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
Peter Baylies
7ade11c4f3
Merge branch 'development' into development 2022-09-17 12:29:25 -04:00
Lincoln Stein
2faa116238 tidy up generation of prompt when variations in use 2022-09-17 11:59:47 -04:00
Lincoln Stein
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
Peter Baylies
c06dc5b85b
Merge branch 'development' into development 2022-09-17 08:43:15 -04:00
Lincoln Stein
34fa6e38e7 fix long hex-encoded error message from legacy server
- closes issue #618
2022-09-17 08:39:20 -04:00
Peter Baylies
f8775f2f2d
Merge branch 'development' into development 2022-09-17 03:45:14 -04:00
Lincoln Stein
b3e026aa4e point legacy web server at legacy static files 2022-09-17 02:18:52 -04:00
Lincoln Stein
b89aadb3c9 fix crash on second prompt #636 2022-09-17 00:57:35 -04:00
blessedcoolant
42072fc15c Bug Fixes 2022-09-17 14:12:35 +12:00
Lincoln Stein
df4c80f177 respect --outdir again; fix issue #628 2022-09-16 19:58:45 -04:00
Lincoln Stein
df95a7ddf2 respect --outdir again; fix issue #628 2022-09-16 19:58:16 -04:00
Peter Baylies
1e3200801f Merge remote-tracking branch 'upstream/development' into development 2022-09-16 19:29:08 -04:00
Lincoln Stein
622db491b2 change tensor length to 768 per #572 2022-09-16 18:25:43 -04:00
Lincoln Stein
d81bc46218
Merge branch 'development' into main 2022-09-16 17:44:15 -04:00
Kevin Schaul
ba4892e03f
Zero-pad intermediate image file names (#616) 2022-09-16 17:32:18 -04:00
Lincoln Stein
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
Lincoln Stein
67fbaa7c31 reconciled conflicting changes to pngwriter call 2022-09-16 16:57:54 -04:00
psychedelicious
ddc68b01f7 Merge remote-tracking branch 'upstream/development' into development 2022-09-17 06:39:22 +10:00
psychedelicious
f9feaac8c7 Fixes metadata related to new args 2022-09-17 06:36:19 +10:00
Lincoln Stein
cbac95b02a Merge with PR #602
- New and improved web api
- Author: @Kyle0654
2022-09-16 16:35:34 -04:00
psychedelicious
d1a2c4cd8c
React web UI with flask-socketio API (#429)
* Implements rudimentary api
* Fixes blocking in API
* Adds UI to monorepo > src/frontend/
* Updates frontend/README
* Reverts conda env name to `ldm`
* Fixes environment yamls
* CORS config for testing
* Fixes LogViewer position
* API WID
* Adds actions to image viewer
* Increases vite chunkSizeWarningLimit to 1500
* Implements init image
* Implements state persistence in localStorage
* Improve progress data handling
* Final build
* Fixes mimetypes error on windows
* Adds error logging
* Fixes bugged img2img strength component
* Adds sourcemaps to dev build
* Fixes missing key
* Changes connection status indicator to text
* Adds ability to serve other hosts than localhost
* Adding Flask API server
* Removes source maps from config
* Fixes prop transfer
* Add missing packages and add CORS support
* Adding API doc
* Remove defaults from openapi doc
* Adds basic error handling for server config query
* Mostly working socket.io implementation.
* Fixes bug preventing mask upload
* Fixes bug with sampler name not written to metadata
* UI Overhaul, numerous fixes

Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-16 13:18:15 -04:00
Lincoln Stein
403d02d94f
implementation of RFC #266 (#587)
* Feature complete for #266 with exception of several small deviations:
1. initial image and model weight hashes use full sha256 hash rather than first 8 digits
2. Initialization parameters for post-processing steps not provided
3. Uses top-level "images" tags for both a single image and a grid of images. This change was suggested in a comment.

* Added scripts/sd_metadata.py to retrieve and print metadata from PNG files
* New ldm.dream.args.Args class is a namespace like object which holds all defaults and can be modified during exection to hold current settings.
* Modified dream.py and server.py to accommodate Args class.
2022-09-16 13:09:04 -04:00
Peter Baylies
9a8fecb2cb
Merge branch 'development' into development 2022-09-16 08:52:27 -04:00
CapableWeb
58baf9533b
Make API return error before raising error again (#606)
This change makes it so any API clients can show the same error as what
happens in the terminal where you run the API. Useful for various WebUIs
to display more helpful error messages to users.

Co-authored-by: CapableWeb <capableweb@domain.com>
2022-09-16 07:33:42 -04:00
Peter Baylies
10f4c0c6b3
Merge branch 'development' into development 2022-09-15 20:25:34 -04:00
ArDiouscuros
f9b272a7b9
Update to exclude GTX 16xx from autocast selection (#576)
* Update to exclude GTX 1660/1650 from autocast selection
2022-09-15 19:29:19 -04:00
Travis Palmer
96d7639d2a Fix visible trailing semi-transparent hard edge in normal tiling mode (when img2img diverges between tiles) using an asymmetric alpha mask in the corner. (LTaC fix) 2022-09-15 17:26:53 -04:00
Peter Baylies
54b9cb49c1
Merge branch 'development' into development 2022-09-15 11:09:27 -04:00
Any-Winter-4079
60b731e7ab
Update dream.py. k_euler_a and k_dpm_2_a M1 fix (#579)
* Update dream.py. k_euler_a and k_dpm_2_a M1 fix

Make results reproducible (so runs with the same seed produce the same result).
Implements fix by @wbowling referenced in https://github.com/lstein/stable-diffusion/issues/397#issuecomment-1240679294

* Update dream.py. Remove import torch from dream.py

* generate.py: k_euler_a and k_dpm_2_a M1 fix #579

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-15 11:02:17 -04:00
Peter Baylies
357e1ad35f
Merge branch 'development' into development 2022-09-15 09:59:11 -04:00
Dominic Letz
8d2afefe6a fixup 2022-09-15 15:45:48 +02:00
Dominic Letz
9faf7025c6 fixup 2022-09-15 15:39:03 +02:00
Dominic Letz
511924c9ab fixup 2022-09-15 15:37:27 +02:00
Dominic Letz
4d997145b4 Add -D for outpainting 2022-09-15 15:34:23 +02:00
Lincoln Stein
9df743e2bf
Web cleanup (#539)
* Refactor generate.py and dream.py

* config file path (models.yaml) is parsed inside Generate() to simplify
API

* Better handling of keyboard interrupts in file loading mode vs
interactive

* Removed oodles of unused variables.

* move nonfunctional inpainting out of the scripts directory

* fix ugly ddim tqdm formatting

* fix embiggen breakage, formatting fixes
2022-09-15 07:43:43 -04:00
William Becher
30e69f8b32
Fix image location on webpage - windows (#568) 2022-09-15 07:40:27 -04:00
Travis Palmer
81bb44319a Hopefully fix embiggen for CPU users, change embiggen seeding behavior, tweak gradient corner 2022-09-14 21:08:16 -04:00
Peter Baylies
66ff890b85
Merge branch 'development' into development 2022-09-14 20:03:39 -04:00
Mihai
dd3fff1d3e
~7% speedup by switch to += in ldm.modules.attention. (#569)
Tested on 8GB eGPU nvidia setup so YMMV.
Re-land with .clone() fix, context #508
2022-09-14 18:10:33 -04:00
Peter Baylies
80579a30e5
Merge branch 'development' into development 2022-09-14 07:10:39 -04:00
Lincoln Stein
5818528aa6
fix web server handling of rel and abs outdir paths (#550)
* fix web server handling of rel and abs outdir paths
* Can now specify either a relative or absolute path for outdir
* Outdir path does not need to be inside the stable-diffusion directory
* Closes security hole that allowed user to read any file within
stable-diffusion (eek!)
* Closes #536
2022-09-14 07:09:01 -04:00
Lincoln Stein
e6179af46a
Refactor generate.py and dream.py (#534)
* revert inadvertent change of conda env name (#528)

* Refactor generate.py and dream.py

* config file path (models.yaml) is parsed inside Generate() to simplify
API

* Better handling of keyboard interrupts in file loading mode vs
interactive

* Removed oodles of unused variables.

* move nonfunctional inpainting out of the scripts directory

* fix ugly ddim tqdm formatting
2022-09-14 07:02:31 -04:00
Peter Baylies
2e438542e9 * Fixes and updates for PR. 2022-09-13 21:56:17 -04:00
Lincoln Stein
0d1aad53ef
Merge branch 'development' into development 2022-09-13 10:57:05 -04:00
Any-Winter-4079
d0a71dc361
Update attention.py for 16-32GB M1 performance (#540)
Code cleanup and attention.py einsum_ops update for M1 16-32GB performance.
Expected: On par with fastest ever from 8 to 128GB for 512x512. Allows large images.
2022-09-13 10:53:45 -04:00
jspraul
e1a6d0c138
web server does not supply embiggen options yet (#535) 2022-09-13 08:29:14 -04:00
Peter Baylies
e1f6ea2be7 Merge branch 'development' of https://github.com/pbaylies/stable-diffusion into development 2022-09-12 18:35:25 -04:00
Peter Baylies
5941ee620c * check for missing parameters. 2022-09-12 18:35:10 -04:00
Peter Baylies
0a6c98e47d
Merge branch 'development' into development 2022-09-12 17:58:27 -04:00
Mihai
dedf8a3692
Remove pointless del statements in diffusionmodules.model. (#520) 2022-09-12 17:39:06 -04:00
Peter Baylies
5e15f1e017
Merge branch 'development' into development 2022-09-12 16:59:15 -04:00
Mihai
0bc6779361
Disable autocast for cpu to fix error. Remove unused precision arg. (#518)
When running on just cpu (intel), a call to torch.layer_norm would error with RuntimeError: expected scalar type BFloat16 but found Float
Fix buggy device handling in model.py.
Tested with scripts/dream.py --full_precision on just cpu on intel laptop. Works but slow at ~10s/it.
2022-09-12 16:55:21 -04:00
Peter Baylies
2a292d5b82 * Fallback in case we don't have get_noise() (using the base class for some reason...) 2022-09-12 16:52:22 -04:00
Peter Baylies
4a5a228fd8
Merge branch 'development' into development 2022-09-12 16:34:10 -04:00
Travco
dbf2c63c90
Add Embiggen automation to upscale-cut-img2img-stitch and achieve high res without extra VRAM (#437)
* Add Embiggen automation

* Make embiggen_tiles masking more intelligent and count from one (at least for the user), rewrite sections of Embiggen README, fix various typos throughout README

* drop duplicate log message
2022-09-12 15:37:26 -04:00
Lincoln Stein
bf1beaa607 revert 49a96b90 due to conflicts during training 2022-09-12 14:34:36 -04:00
Lincoln Stein
9d6d728b51 Squashed commit of the following:
commit 1c649e4663
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 12 13:29:16 2022 -0400

    fix torchvision dependency version #511

commit 4d197f699e
Merge: a3e07fb 190ba78
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 12 07:29:19 2022 -0400

    Merge branch 'development' of github.com:lstein/stable-diffusion into development

commit a3e07fb84a
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 12 07:28:58 2022 -0400

    fix grid crash

commit 9fa1f31bf2
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 12 07:07:05 2022 -0400

    fix opencv and realesrgan dependencies in mac install

commit 190ba78960
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 12 01:50:58 2022 -0400

    Update requirements-mac.txt

    Fixed dangling dash on last line.

commit 25d9ccc509
Author: Any-Winter-4079 <50542132+Any-Winter-4079@users.noreply.github.com>
Date:   Mon Sep 12 03:17:29 2022 +0200

    Update model.py

commit 9cdf3aca7d
Author: Any-Winter-4079 <50542132+Any-Winter-4079@users.noreply.github.com>
Date:   Mon Sep 12 02:52:36 2022 +0200

    Update attention.py

    Performance improvements to generate larger images in M1 #431

    Update attention.py

    Added dtype=r1.dtype to softmax

commit 49a96b90d8
Author: Mihai <299015+mh-dm@users.noreply.github.com>
Date:   Sat Sep 10 16:58:07 2022 +0300

    ~7% speedup (1.57 to 1.69it/s) from switch to += in ldm.modules.attention. (#482)

    Tested on 8GB eGPU nvidia setup so YMMV.
    512x512 output, max VRAM stays same.

commit aba94b85e8
Author: Niek van der Maas <mail@niekvandermaas.nl>
Date:   Fri Sep 9 15:01:37 2022 +0200

    Fix macOS `pyenv` instructions, add code block highlight (#441)

    Fix: `anaconda3-latest` does not work, specify the correct virtualenv, add missing init.

commit aac5102cf3
Author: Henry van Megen <h.vanmegen@gmail.com>
Date:   Thu Sep 8 05:16:35 2022 +0200

    Disabled debug output (#436)

    Co-authored-by: Henry van Megen <hvanmegen@gmail.com>

commit 0ab5a36464
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 17:19:46 2022 -0400

    fix missing lines in outputs

commit 5e433728b5
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 16:20:14 2022 -0400

    upped max_steps in v1-finetune.yaml and fixed TI docs to address #493

commit 7708f4fb98
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 16:03:37 2022 -0400

    slight efficiency gain by using += in attention.py

commit b86a1deb00
Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com>
Date:   Mon Sep 12 07:47:12 2022 +1200

    Remove print statement styling (#504)

    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit 4951e66103
Author: chromaticist <mhostick@gmail.com>
Date:   Sun Sep 11 12:44:26 2022 -0700

    Adding support for .bin files from huggingface concepts (#498)

    * Adding support for .bin files from huggingface concepts

    * Updating documentation to include huggingface .bin info

commit 79b445b0ca
Merge: a323070 f7662c1
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 15:39:38 2022 -0400

    Merge branch 'development' of github.com:lstein/stable-diffusion into development

commit a323070a4d
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 15:28:57 2022 -0400

    update requirements for new location of gfpgan

commit f7662c1808
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 15:00:24 2022 -0400

    update requirements for changed location of gfpgan

commit 93c242c9fb
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:47:58 2022 -0400

    make gfpgan_model_exists flag available to web interface

commit c7c6cd7735
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:43:07 2022 -0400

    Update UPSCALE.md

    New instructions needed to accommodate fact that the ESRGAN and GFPGAN packages are now installed by environment.yaml.

commit 77ca83e103
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:31:56 2022 -0400

    Update CLI.md

    Final documentation tweak.

commit 0ea145d188
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:29:26 2022 -0400

    Update CLI.md

    More doc fixes.

commit 162285ae86
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:28:45 2022 -0400

    Update CLI.md

    Minor documentation fix

commit 37c921dfe2
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 14:26:41 2022 -0400

    documentation enhancements

commit 4f72cb44ad
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 13:05:38 2022 -0400

    moved the notebook files into their own directory

commit 878ef2e9e0
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 12:58:06 2022 -0400

    documentation tweaks

commit 4923118610
Merge: 16f6a67 defafc0
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 12:51:25 2022 -0400

    Merge branch 'development' of github.com:lstein/stable-diffusion into development

commit defafc0e8e
Author: Dominic Letz <dominic@diode.io>
Date:   Sun Sep 11 18:51:01 2022 +0200

    Enable upscaling on m1 (#474)

commit 16f6a6731d
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 12:47:26 2022 -0400

    install GFPGAN inside SD repository in order to fix 'dark cast' issue #169

commit 0881d429f2
Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com>
Date:   Mon Sep 12 03:52:43 2022 +1200

    Docs Update (#466)

    Authored-by: @blessedcoolant
    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit 9a29d442b4
Author: Gérald LONLAS <gerald@lonlas.com>
Date:   Sun Sep 11 23:23:18 2022 +0800

    Revert "Add 3x Upscale option on the Web UI (#442)" (#488)

    This reverts commit f8a540881c.

commit d301836fbd
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 10:52:19 2022 -0400

    can select prior output for init_img using -1, -2, etc

commit 70aa674e9e
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 10:34:06 2022 -0400

    merge PR #495 - keep using float16 in ldm.modules.attention

commit 8748370f44
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 10:22:32 2022 -0400

    negative -S indexing recovers correct previous seed; closes issue #476

commit 839e30e4b8
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 11 10:02:44 2022 -0400

    improve CUDA VRAM monitoring

    extra check that device==cuda before getting VRAM stats

commit bfb2781279
Author: tildebyte <337875+tildebyte@users.noreply.github.com>
Date:   Sat Sep 10 10:15:56 2022 -0400

    fix(readme): add note about updating env via conda (#475)

commit 5c43988862
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 10 10:02:43 2022 -0400

    reduce VRAM memory usage by half during model loading

    * This moves the call to half() before model.to(device) to avoid GPU
    copy of full model. Improves speed and reduces memory usage dramatically

    * This fix contributed by @mh-dm (Mihai)

commit 99122708ca
Merge: 817c4a2 ecc6b75
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 10 09:54:34 2022 -0400

    Merge branch 'development' of github.com:lstein/stable-diffusion into development

commit 817c4a26de
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 10 09:53:27 2022 -0400

    remove -F option from normalized prompt; closes #483

commit ecc6b75a3e
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 10 09:53:27 2022 -0400

    remove -F option from normalized prompt

commit 723d074442
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Fri Sep 9 18:49:51 2022 -0400

    Allow ctrl c when using --from_file (#472)

    * added ansi escapes to highlight key parts of CLI session

    * adjust exception handling so that ^C will abort when reading prompts from a file

commit 75f633cda8
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Fri Sep 9 12:03:45 2022 -0400

    re-add new logo

commit 10db192cc4
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Fri Sep 9 09:26:10 2022 -0400

    changes to dogettx optimizations to run on m1
    * Author @any-winter-4079
    * Author @dogettx
    Thanks to many individuals who contributed time and hardware to
    benchmarking and debugging these changes.

commit c85ae00b33
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 23:57:45 2022 -0400

    fix bug which caused seed to get "stuck" on previous image even when UI specified -1

commit 1b5aae3ef3
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:36:47 2022 -0400

    add icon to dream web server

commit 6abf739315
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:25:09 2022 -0400

    add favicon to web server

commit db825b8138
Merge: 33874ba afee7f9
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:17:37 2022 -0400

    Merge branch 'deNULL-development' into development

commit 33874bae8d
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:16:29 2022 -0400

    Squashed commit of the following:

    commit afee7f9cea
    Merge: 6531446 171f8db
    Author: Lincoln Stein <lincoln.stein@gmail.com>
    Date:   Thu Sep 8 22:14:32 2022 -0400

        Merge branch 'development' of github.com:deNULL/stable-diffusion into deNULL-development

    commit 171f8db742
    Author: Denis Olshin <me@denull.ru>
    Date:   Thu Sep 8 03:15:20 2022 +0300

        saving full prompt to metadata when using web ui

    commit d7e67b62f0
    Author: Denis Olshin <me@denull.ru>
    Date:   Thu Sep 8 01:51:47 2022 +0300

        better logic for clicking to make variations

commit afee7f9cea
Merge: 6531446 171f8db
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:14:32 2022 -0400

    Merge branch 'development' of github.com:deNULL/stable-diffusion into deNULL-development

commit 653144694f
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 20:41:37 2022 -0400

    work around unexplained crash when timesteps=1000 (#440)

    * work around unexplained crash when timesteps=1000

    * this fix seems to work

commit c33a84cdfd
Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com>
Date:   Fri Sep 9 12:39:51 2022 +1200

    Add New Logo (#454)

    * Add instructions on how to install alongside pyenv (#393)

    Like probably many others, I have a lot of different virtualenvs, one for each project. Most of them are handled by `pyenv`.
    After installing according to these instructions I had issues with ´pyenv`and `miniconda` fighting over the $PATH of my system.
    But then I stumbled upon this nice solution on SO: https://stackoverflow.com/a/73139031 , upon which I have based my suggested changes.

    It runs perfectly on my M1 setup, with the anaconda setup as a virtual environment handled by pyenv.

    Feel free to incorporate these instructions as you see fit.

    Thanks a million for all your hard work.

    * Disabled debug output (#436)

    Co-authored-by: Henry van Megen <hvanmegen@gmail.com>

    * Add New Logo

    Co-authored-by: Håvard Gulldahl <havard@lurtgjort.no>
    Co-authored-by: Henry van Megen <h.vanmegen@gmail.com>
    Co-authored-by: Henry van Megen <hvanmegen@gmail.com>
    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit f8a540881c
Author: Gérald LONLAS <gerald@lonlas.com>
Date:   Fri Sep 9 01:45:54 2022 +0800

    Add 3x Upscale option on the Web UI (#442)

commit 244239e5f6
Author: James Reynolds <magnusviri@users.noreply.github.com>
Date:   Thu Sep 8 05:36:33 2022 -0600

    macOS CI workflow, dream.py exits with an error, but the workflow com… (#396)

    * macOS CI workflow, dream.py exits with an error, but the workflow completes.

    * Files for testing

    Co-authored-by: James Reynolds <magnsuviri@me.com>
    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit 711d49ed30
Author: James Reynolds <magnusviri@users.noreply.github.com>
Date:   Thu Sep 8 05:35:08 2022 -0600

    Cache model workflow (#394)

    * Add workflow that caches the model, step 1 for CI

    * Change name of workflow job

    Co-authored-by: James Reynolds <magnsuviri@me.com>
    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit 7996a30e3a
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 07:34:03 2022 -0400

    add auto-creation of mask for inpainting (#438)

    * now use a single init image for both image and mask

    * turn on debugging for now to write out mask and image

    * add back -M option as a fallback

commit a69ca31f34
Author: elliotsayes <elliotsayes@gmail.com>
Date:   Thu Sep 8 15:30:06 2022 +1200

    .gitignore WebUI temp files (#430)

    * Add instructions on how to install alongside pyenv (#393)

    Like probably many others, I have a lot of different virtualenvs, one for each project. Most of them are handled by `pyenv`.
    After installing according to these instructions I had issues with ´pyenv`and `miniconda` fighting over the $PATH of my system.
    But then I stumbled upon this nice solution on SO: https://stackoverflow.com/a/73139031 , upon which I have based my suggested changes.

    It runs perfectly on my M1 setup, with the anaconda setup as a virtual environment handled by pyenv.

    Feel free to incorporate these instructions as you see fit.

    Thanks a million for all your hard work.

    * .gitignore WebUI temp files

    Co-authored-by: Håvard Gulldahl <havard@lurtgjort.no>

commit 5c6b612a72
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Wed Sep 7 22:50:55 2022 -0400

    fix bug that caused same seed to be redisplayed repeatedly

commit 56f155c590
Author: Johan Roxendal <johan@roxendal.com>
Date:   Thu Sep 8 04:50:06 2022 +0200

    added support for parsing run log and displaying images in the frontend init state (#410)

    Co-authored-by: Johan Roxendal <johan.roxendal@litteraturbanken.se>
    Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>

commit 41687746be
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Wed Sep 7 20:24:35 2022 -0400

    added missing initialization of latent_noise to None

commit 171f8db742
Author: Denis Olshin <me@denull.ru>
Date:   Thu Sep 8 03:15:20 2022 +0300

    saving full prompt to metadata when using web ui

commit d7e67b62f0
Author: Denis Olshin <me@denull.ru>
Date:   Thu Sep 8 01:51:47 2022 +0300

    better logic for clicking to make variations

commit d1d044aa87
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Wed Sep 7 17:56:59 2022 -0400

    actual image seed now written into web log rather than -1 (#428)

commit edada042b3
Author: Arturo Mendivil <60411196+artmen1516@users.noreply.github.com>
Date:   Wed Sep 7 10:42:26 2022 -0700

    Improve notebook and add requirements file (#422)

commit 29ab3c2028
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Wed Sep 7 13:28:11 2022 -0400

    disable neonpixel optimizations on M1 hardware (#414)

    * disable neonpixel optimizations on M1 hardware

    * fix typo that was causing random noise images on m1

commit 7670ecc63f
Author: cody <cnmizell@gmail.com>
Date:   Wed Sep 7 12:24:41 2022 -0500

    add more keyboard support on the web server (#391)

    add ability to submit prompts with the "enter" key
    add ability to cancel generations with the "escape" key

commit dd2aedacaf
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Wed Sep 7 13:23:53 2022 -0400

    report VRAM usage stats during initial model loading (#419)

commit f6284777e6
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Tue Sep 6 17:12:39 2022 -0400

    Squashed commit of the following:

    commit 7d1344282d942a33dcecda4d5144fc154ec82915
    Merge: caf4ea3 ebeb556
    Author: Lincoln Stein <lincoln.stein@gmail.com>
    Date:   Mon Sep 5 10:07:27 2022 -0400

        Merge branch 'development' of github.com:WebDev9000/stable-diffusion into WebDev9000-development

    commit ebeb556af9
    Author: Web Dev 9000 <rirath@gmail.com>
    Date:   Sun Sep 4 18:05:15 2022 -0700

        Fixed unintentionally removed lines

    commit ff2c4b9a1b
    Author: Web Dev 9000 <rirath@gmail.com>
    Date:   Sun Sep 4 17:50:13 2022 -0700

        Add ability to recreate variations via image click

    commit c012929cda
    Author: Web Dev 9000 <rirath@gmail.com>
    Date:   Sun Sep 4 14:35:33 2022 -0700

        Add files via upload

    commit 02a6018992
    Author: Web Dev 9000 <rirath@gmail.com>
    Date:   Sun Sep 4 14:35:07 2022 -0700

        Add files via upload

commit eef788981c
Author: Olivier Louvignes <olivier@mg-crea.com>
Date:   Tue Sep 6 12:41:08 2022 +0200

    feat(txt2img): allow from_file to work with len(lines) < batch_size (#349)

commit 720e5cd651
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 5 20:40:10 2022 -0400

    Refactoring simplet2i (#387)

    * start refactoring -not yet functional

    * first phase of refactor done - not sure weighted prompts working

    * Second phase of refactoring. Everything mostly working.
    * The refactoring has moved all the hard-core inference work into
    ldm.dream.generator.*, where there are submodules for txt2img and
    img2img. inpaint will go in there as well.
    * Some additional refactoring will be done soon, but relatively
    minor work.

    * fix -save_orig flag to actually work

    * add @neonsecret attention.py memory optimization

    * remove unneeded imports

    * move token logging into conditioning.py

    * add placeholder version of inpaint; porting in progress

    * fix crash in img2img

    * inpainting working; not tested on variations

    * fix crashes in img2img

    * ported attention.py memory optimization #117 from basujindal branch

    * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures

    * Final commit prior to PR against development
    * fixup crash when generating intermediate images in web UI
    * rename ldm.simplet2i to ldm.generate
    * add backward-compatibility simplet2i shell with deprecation warning

    * add back in mps exception, addresses @vargol comment in #354

    * replaced Conditioning class with exported functions

    * fix wrong type of with_variations attribute during intialization

    * changed "image_iterator()" to "get_make_image()"

    * raise NotImplementedError for calling get_make_image() in parent class

    * Update ldm/generate.py

    better error message

    Co-authored-by: Kevin Gibbons <bakkot@gmail.com>

    * minor stylistic fixes and assertion checks from code review

    * moved get_noise() method into img2img class

    * break get_noise() into two methods, one for txt2img and the other for img2img

    * inpainting works on non-square images now

    * make get_noise() an abstract method in base class

    * much improved inpainting

    Co-authored-by: Kevin Gibbons <bakkot@gmail.com>

commit 1ad2a8e567
Author: thealanle <35761977+thealanle@users.noreply.github.com>
Date:   Mon Sep 5 17:35:04 2022 -0700

    Fix --outdir function for web (#373)

    * Fix --outdir function for web

    * Removed unnecessary hardcoded path

commit 52d8bb2836
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 5 10:31:59 2022 -0400

    Squashed commit of the following:

    commit 0cd48e932f1326e000c46f4140f98697eb9bdc79
    Author: Lincoln Stein <lincoln.stein@gmail.com>
    Date:   Mon Sep 5 10:27:43 2022 -0400

        resolve conflicts with development

    commit d7bc8c12e0
    Author: Scott McMillin <scott@scottmcmillin.com>
    Date:   Sun Sep 4 18:52:09 2022 -0500

        Add title attribute back to img tag

    commit 5397c89184
    Author: Scott McMillin <scott@scottmcmillin.com>
    Date:   Sun Sep 4 13:49:46 2022 -0500

        Remove temp code

    commit 1da080b509
    Author: Scott McMillin <scott@scottmcmillin.com>
    Date:   Sun Sep 4 13:33:56 2022 -0500

        Cleaned up HTML; small style changes; image click opens image; add seed to figcaption beneath image

commit caf4ea3d89
Author: Adam Rice <adam@askadam.io>
Date:   Mon Sep 5 10:05:39 2022 -0400

    Add a 'Remove Image' button to clear the file upload field (#382)

    * added "remove image" button

    * styled a new "remove image" button

    * Update index.js

commit 95c088b303
Author: Kevin Gibbons <bakkot@gmail.com>
Date:   Sun Sep 4 19:04:14 2022 -0700

    Revert "Add CORS headers to dream server to ease integration with third-party web interfaces" (#371)

    This reverts commit 91e826e5f4.

commit a20113d5a3
Author: Kevin Gibbons <bakkot@gmail.com>
Date:   Sun Sep 4 18:59:12 2022 -0700

    put no_grad decorator on make_image closures (#375)

commit 0f93dadd6a
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 4 21:39:15 2022 -0400

    fix several dangling references to --gfpgan option, which no longer exists

commit f4004f660e
Author: tildebyte <337875+tildebyte@users.noreply.github.com>
Date:   Sun Sep 4 19:43:04 2022 -0400

    TOIL(requirements): Split requirements to per-platform (#355)

    * toil(reqs): split requirements to per-platform

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

    * toil(reqs): fix for Win and Lin...

    ...allow pip to resolve latest torch, numpy

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

    * toil(install): update reqs in Win install notebook

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

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

commit 4406fd138d
Merge: 5116c81 fd7a72e
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 4 08:23:53 2022 -0400

    Merge branch 'SebastianAigner-main' into development
    Add support for full CORS headers for dream server.

commit fd7a72e147
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 4 08:23:11 2022 -0400

    remove debugging message

commit 3a2be621f3
Merge: 91e826e 5116c81
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sun Sep 4 08:15:51 2022 -0400

    Merge branch 'development' into main

commit 5116c8178c
Author: Justin Wong <1584142+wongjustin99@users.noreply.github.com>
Date:   Sun Sep 4 07:17:58 2022 -0400

    fix save_original flag saving to the same filename (#360)

    * Update README.md with new Anaconda install steps (#347)

    pip3 version did not work for me and this is the recommended way to install Anaconda now it seems

    * fix save_original flag saving to the same filename

    Before this, the `--save_orig` flag was not working. The upscaled/GFPGAN would overwrite the original output image.

    Co-authored-by: greentext2 <112735219+greentext2@users.noreply.github.com>

commit 91e826e5f4
Author: Sebastian Aigner <SebastianAigner@users.noreply.github.com>
Date:   Sun Sep 4 10:22:54 2022 +0200

    Add CORS headers to dream server to ease integration with third-party web interfaces

commit 6266d9e8d6
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 15:45:20 2022 -0400

    remove stray debugging message

commit 138956e516
Author: greentext2 <112735219+greentext2@users.noreply.github.com>
Date:   Sat Sep 3 13:38:57 2022 -0500

    Update README.md with new Anaconda install steps (#347)

    pip3 version did not work for me and this is the recommended way to install Anaconda now it seems

commit 60be735e80
Author: Cora Johnson-Roberson <cora.johnson.roberson@gmail.com>
Date:   Sat Sep 3 14:28:34 2022 -0400

    Switch to regular pytorch channel and restore Python 3.10 for Macs. (#301)

    * Switch to regular pytorch channel and restore Python 3.10 for Macs.

    Although pytorch-nightly should in theory be faster, it is currently
    causing increased memory usage and slower iterations:

    https://github.com/lstein/stable-diffusion/pull/283#issuecomment-1234784885

    This changes the environment-mac.yaml file back to the regular pytorch
    channel and moves the `transformers` dep into pip for now (since it
    cannot be satisfied until tokenizers>=0.11 is built for Python 3.10).

    * Specify versions for Pip packages as well.

commit d0d95d3a2a
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 14:10:31 2022 -0400

    make initimg appear in web log

commit b90a215000
Merge: 1eee811 6270e31
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 13:47:15 2022 -0400

    Merge branch 'prixt-seamless' into development

commit 6270e313b8
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 13:46:29 2022 -0400

    add credit to prixt for seamless circular tiling

commit a01b7bdc40
Merge: 1eee811 9d88abe
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 13:43:04 2022 -0400

    add web interface for seamless option

commit 1eee8111b9
Merge: 64eca42 fb857f0
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 12:33:39 2022 -0400

    Merge branch 'development' of github.com:lstein/stable-diffusion into development

commit 64eca42610
Merge: 9130ad7 21a1f68
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 12:33:05 2022 -0400

    Merge branch 'main' into development
    * brings in small documentation fixes that were
    added directly to main during release tweaking.

commit fb857f05ba
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Sat Sep 3 12:07:07 2022 -0400

    fix typo in docs

commit 9d88abe2ea
Author: prixt <paraxite@naver.com>
Date:   Sat Sep 3 22:42:16 2022 +0900

    fixed typo

commit a61e49bc97
Author: prixt <paraxite@naver.com>
Date:   Sat Sep 3 22:39:35 2022 +0900

    * Removed unnecessary code
    * Added description about --seamless

commit 02bee4fdb1
Author: prixt <paraxite@naver.com>
Date:   Sat Sep 3 16:08:03 2022 +0900

    added --seamless tag logging to normalize_prompt

commit d922b53c26
Author: prixt <paraxite@naver.com>
Date:   Sat Sep 3 15:13:31 2022 +0900

    added seamless tiling mode and commands
2022-09-12 14:31:48 -04:00
Peter Baylies
ea60d036d1
Merge branch 'development' into development 2022-09-12 10:37:49 -04:00
Lincoln Stein
9fa1f31bf2 fix opencv and realesrgan dependencies in mac install 2022-09-12 07:07:05 -04:00
Peter Baylies
77db46f99e
Merge branch 'development' into development 2022-09-12 04:50:40 -04:00
Any-Winter-4079
25d9ccc509 Update model.py 2022-09-11 22:37:45 -04:00
Any-Winter-4079
9cdf3aca7d Update attention.py
Performance improvements to generate larger images in M1 #431

Update attention.py

Added dtype=r1.dtype to softmax
2022-09-11 22:36:58 -04:00
Henry van Megen
aac5102cf3 Disabled debug output (#436)
Co-authored-by: Henry van Megen <hvanmegen@gmail.com>
2022-09-11 22:34:35 -04:00
Peter Baylies
45673e8723
Merge branch 'development' into development 2022-09-11 19:03:29 -04:00
Lincoln Stein
7708f4fb98 slight efficiency gain by using += in attention.py 2022-09-11 16:03:54 -04:00
chromaticist
4951e66103
Adding support for .bin files from huggingface concepts (#498)
* Adding support for .bin files from huggingface concepts

* Updating documentation to include huggingface .bin info
2022-09-11 15:44:26 -04:00
Lincoln Stein
93c242c9fb make gfpgan_model_exists flag available to web interface 2022-09-11 14:47:58 -04:00
Lincoln Stein
4923118610 Merge branch 'development' of github.com:lstein/stable-diffusion into development 2022-09-11 12:51:25 -04:00
Dominic Letz
defafc0e8e
Enable upscaling on m1 (#474) 2022-09-11 12:51:01 -04:00
Lincoln Stein
16f6a6731d install GFPGAN inside SD repository in order to fix 'dark cast' issue #169 2022-09-11 12:47:26 -04:00
Lincoln Stein
70aa674e9e merge PR #495 - keep using float16 in ldm.modules.attention 2022-09-11 10:34:06 -04:00
Peter Baylies
737a97c898
Merge branch 'development' into development 2022-09-11 10:30:23 -04:00
Lincoln Stein
839e30e4b8 improve CUDA VRAM monitoring
extra check that device==cuda before getting VRAM stats
2022-09-11 10:10:24 -04:00
Peter Baylies
c6be8f320d
Merge branch 'development' into development 2022-09-10 10:31:32 -04:00
Lincoln Stein
5c43988862 reduce VRAM memory usage by half during model loading
* This moves the call to half() before model.to(device) to avoid GPU
copy of full model. Improves speed and reduces memory usage dramatically

* This fix contributed by @mh-dm (Mihai)
2022-09-10 10:02:43 -04:00
Mihai
62863ac586
~7% speedup (1.57 to 1.69it/s) from switch to += in ldm.modules.attention. (#482)
Tested on 8GB eGPU nvidia setup so YMMV.
512x512 output, max VRAM stays same.
2022-09-10 09:58:07 -04:00
Lincoln Stein
817c4a26de remove -F option from normalized prompt; closes #483 2022-09-10 09:54:26 -04:00
Peter Baylies
103b3e7965
Merge branch 'development' into development 2022-09-10 07:43:54 -04:00
Lincoln Stein
723d074442
Allow ctrl c when using --from_file (#472)
* added ansi escapes to highlight key parts of CLI session

* adjust exception handling so that ^C will abort when reading prompts from a file
2022-09-09 18:49:51 -04:00
Peter Baylies
424f4fe244
Merge branch 'development' into development 2022-09-09 13:15:43 -04:00
Lincoln Stein
10db192cc4 changes to dogettx optimizations to run on m1
* Author @any-winter-4079
* Author @dogettx
Thanks to many individuals who contributed time and hardware to
benchmarking and debugging these changes.
2022-09-09 09:51:41 -04:00
Peter Baylies
c41599746d
Merge branch 'development' into development 2022-09-09 00:19:17 -04:00
Lincoln Stein
c85ae00b33 fix bug which caused seed to get "stuck" on previous image even when UI specified -1 2022-09-08 23:57:45 -04:00
Peter Baylies
7f0cc7072b
Merge branch 'development' into development 2022-09-08 22:54:26 -04:00
Lincoln Stein
33874bae8d Squashed commit of the following:
commit afee7f9cea
Merge: 6531446 171f8db
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Thu Sep 8 22:14:32 2022 -0400

    Merge branch 'development' of github.com:deNULL/stable-diffusion into deNULL-development

commit 171f8db742
Author: Denis Olshin <me@denull.ru>
Date:   Thu Sep 8 03:15:20 2022 +0300

    saving full prompt to metadata when using web ui

commit d7e67b62f0
Author: Denis Olshin <me@denull.ru>
Date:   Thu Sep 8 01:51:47 2022 +0300

    better logic for clicking to make variations
2022-09-08 22:16:29 -04:00
Lincoln Stein
653144694f
work around unexplained crash when timesteps=1000 (#440)
* work around unexplained crash when timesteps=1000

* this fix seems to work
2022-09-08 20:41:37 -04:00
blessedcoolant
c33a84cdfd
Add New Logo (#454)
* Add instructions on how to install alongside pyenv (#393)

Like probably many others, I have a lot of different virtualenvs, one for each project. Most of them are handled by `pyenv`. 
After installing according to these instructions I had issues with ´pyenv`and `miniconda` fighting over the $PATH of my system.
But then I stumbled upon this nice solution on SO: https://stackoverflow.com/a/73139031 , upon which I have based my suggested changes.

It runs perfectly on my M1 setup, with the anaconda setup as a virtual environment handled by pyenv. 

Feel free to incorporate these instructions as you see fit. 

Thanks a million for all your hard work.

* Disabled debug output (#436)

Co-authored-by: Henry van Megen <hvanmegen@gmail.com>

* Add New Logo

Co-authored-by: Håvard Gulldahl <havard@lurtgjort.no>
Co-authored-by: Henry van Megen <h.vanmegen@gmail.com>
Co-authored-by: Henry van Megen <hvanmegen@gmail.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-08 20:39:51 -04:00
Peter Baylies
c71d8750f7
Merge branch 'development' into development 2022-09-08 10:23:23 -04:00
Lincoln Stein
7996a30e3a
add auto-creation of mask for inpainting (#438)
* now use a single init image for both image and mask

* turn on debugging for now to write out mask and image

* add back -M option as a fallback
2022-09-08 07:34:03 -04:00
Henry van Megen
049ea02fc7
Disabled debug output (#436)
Co-authored-by: Henry van Megen <hvanmegen@gmail.com>
2022-09-07 23:16:35 -04:00
Peter Baylies
ab39bc0bac
Merge branch 'development' into development 2022-09-07 23:15:09 -04:00
Lincoln Stein
5c6b612a72 fix bug that caused same seed to be redisplayed repeatedly 2022-09-07 22:50:55 -04:00
Johan Roxendal
56f155c590
added support for parsing run log and displaying images in the frontend init state (#410)
Co-authored-by: Johan Roxendal <johan.roxendal@litteraturbanken.se>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-07 22:50:06 -04:00
Peter Baylies
bd4fc64156
Merge branch 'development' into development 2022-09-07 21:30:39 -04:00
Lincoln Stein
41687746be added missing initialization of latent_noise to None 2022-09-07 20:24:35 -04:00
Lincoln Stein
d1d044aa87
actual image seed now written into web log rather than -1 (#428) 2022-09-07 17:56:59 -04:00
Peter Baylies
8b0d1e59fe
Merge branch 'development' into development 2022-09-07 15:23:58 -04:00
Lincoln Stein
29ab3c2028
disable neonpixel optimizations on M1 hardware (#414)
* disable neonpixel optimizations on M1 hardware

* fix typo that was causing random noise images on m1
2022-09-07 13:28:11 -04:00
Lincoln Stein
dd2aedacaf
report VRAM usage stats during initial model loading (#419) 2022-09-07 13:23:53 -04:00
Peter Baylies
dc500946ad * Make warmup feature less aggressive to support higher thresholding values properly. 2022-09-07 04:50:53 -04:00
Peter Baylies
a48c03e0f4
Merge branch 'development' into development 2022-09-06 17:25:28 -04:00
Lincoln Stein
f6284777e6 Squashed commit of the following:
commit 7d1344282d942a33dcecda4d5144fc154ec82915
Merge: caf4ea3 ebeb556
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 5 10:07:27 2022 -0400

    Merge branch 'development' of github.com:WebDev9000/stable-diffusion into WebDev9000-development

commit ebeb556af9
Author: Web Dev 9000 <rirath@gmail.com>
Date:   Sun Sep 4 18:05:15 2022 -0700

    Fixed unintentionally removed lines

commit ff2c4b9a1b
Author: Web Dev 9000 <rirath@gmail.com>
Date:   Sun Sep 4 17:50:13 2022 -0700

    Add ability to recreate variations via image click

commit c012929cda
Author: Web Dev 9000 <rirath@gmail.com>
Date:   Sun Sep 4 14:35:33 2022 -0700

    Add files via upload

commit 02a6018992
Author: Web Dev 9000 <rirath@gmail.com>
Date:   Sun Sep 4 14:35:07 2022 -0700

    Add files via upload
2022-09-06 17:12:39 -04:00
Peter Baylies
8c8b34a889 * Update to resolve conflicts. 2022-09-05 22:57:33 -04:00
Peter Baylies
7ff94383ce Merge branch 'development' of https://github.com/lstein/stable-diffusion into development 2022-09-05 22:57:03 -04:00
Peter Baylies
0891910cac * Updates for thresholding and perlin noise options, added warmup for thresholding. 2022-09-05 21:40:05 -04:00
Lincoln Stein
720e5cd651
Refactoring simplet2i (#387)
* start refactoring -not yet functional

* first phase of refactor done - not sure weighted prompts working

* Second phase of refactoring. Everything mostly working.
* The refactoring has moved all the hard-core inference work into
ldm.dream.generator.*, where there are submodules for txt2img and
img2img. inpaint will go in there as well.
* Some additional refactoring will be done soon, but relatively
minor work.

* fix -save_orig flag to actually work

* add @neonsecret attention.py memory optimization

* remove unneeded imports

* move token logging into conditioning.py

* add placeholder version of inpaint; porting in progress

* fix crash in img2img

* inpainting working; not tested on variations

* fix crashes in img2img

* ported attention.py memory optimization #117 from basujindal branch

* added @torch_no_grad() decorators to img2img, txt2img, inpaint closures

* Final commit prior to PR against development
* fixup crash when generating intermediate images in web UI
* rename ldm.simplet2i to ldm.generate
* add backward-compatibility simplet2i shell with deprecation warning

* add back in mps exception, addresses @vargol comment in #354

* replaced Conditioning class with exported functions

* fix wrong type of with_variations attribute during intialization

* changed "image_iterator()" to "get_make_image()"

* raise NotImplementedError for calling get_make_image() in parent class

* Update ldm/generate.py

better error message

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>

* minor stylistic fixes and assertion checks from code review

* moved get_noise() method into img2img class

* break get_noise() into two methods, one for txt2img and the other for img2img

* inpainting works on non-square images now

* make get_noise() an abstract method in base class

* much improved inpainting

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-05 20:40:10 -04:00
thealanle
1ad2a8e567
Fix --outdir function for web (#373)
* Fix --outdir function for web

* Removed unnecessary hardcoded path
2022-09-05 20:35:04 -04:00
Kevin Gibbons
95c088b303
Revert "Add CORS headers to dream server to ease integration with third-party web interfaces" (#371)
This reverts commit 91e826e5f4.
2022-09-04 22:04:14 -04:00
Kevin Gibbons
a20113d5a3
put no_grad decorator on make_image closures (#375) 2022-09-04 21:59:12 -04:00
Lincoln Stein
0f93dadd6a fix several dangling references to --gfpgan option, which no longer exists 2022-09-04 21:39:15 -04:00
Lincoln Stein
fd7a72e147 remove debugging message 2022-09-04 08:23:11 -04:00
Lincoln Stein
3a2be621f3
Merge branch 'development' into main 2022-09-04 08:15:51 -04:00
Justin Wong
5116c8178c
fix save_original flag saving to the same filename (#360)
* Update README.md with new Anaconda install steps (#347)

pip3 version did not work for me and this is the recommended way to install Anaconda now it seems

* fix save_original flag saving to the same filename

Before this, the `--save_orig` flag was not working. The upscaled/GFPGAN would overwrite the original output image.

Co-authored-by: greentext2 <112735219+greentext2@users.noreply.github.com>
2022-09-04 07:17:58 -04:00
Sebastian Aigner
91e826e5f4 Add CORS headers to dream server to ease integration with third-party web interfaces 2022-09-04 10:22:54 +02:00
Kevin Gibbons
751283a2de
fix img2img variations/MPS (#353)
* fix img2img variations

* fix assert for variation_amount
2022-09-04 00:34:20 -06:00
Lincoln Stein
6266d9e8d6 remove stray debugging message 2022-09-03 15:45:20 -04:00
Lincoln Stein
d0d95d3a2a make initimg appear in web log 2022-09-03 14:10:31 -04:00
Lincoln Stein
a01b7bdc40 add web interface for seamless option 2022-09-03 13:43:04 -04:00
Lincoln Stein
5454a0edc2 code cleanup
* check that fixed side provided when requesting variant parameter sweep
(-v)
* move _get_noise() into outer scope to improve readability -
refactoring of big method call needed
2022-09-03 10:40:20 -04:00
Lincoln Stein
fe5cc79249 fixes dream.py mps seed 2022-09-03 10:11:46 -04:00
Lincoln Stein
91cce6b4c3 move special-casing test for precision on mps into T2I class 2022-09-03 09:43:18 -04:00
Lincoln Stein
d8c0d020eb remove space between -V and its value in generated prompt, for consistency with other switches 2022-09-03 09:08:10 -04:00
Peter Baylies
1a4bed2e55 Merge branch 'development' of https://github.com/lstein/stable-diffusion into development 2022-09-03 05:02:25 -04:00
prixt
02bee4fdb1 added --seamless tag logging to normalize_prompt 2022-09-03 16:08:03 +09:00
Kevin Gibbons
e918cb1a8a replace list delimiters in variations syntax 2022-09-02 23:51:22 -07:00
prixt
d922b53c26 added seamless tiling mode and commands 2022-09-03 15:13:31 +09:00
Lincoln Stein
dd2af3f93c added walkthru, small code fixes 2022-09-02 17:54:55 -04:00
Lincoln Stein
2d65b03f05 Merge branch 'seed-fuzz' of github.com:bakkot/stable-diffusion into bakkot-seed-fuzz 2022-09-02 16:17:51 -04:00
Peter Baylies
70ef83ac30 Merge branch 'development' of https://github.com/lstein/stable-diffusion into development 2022-09-02 13:39:53 -04:00
Peter Baylies
b6cf8b9052 * Add threshold and perlin noise options for Karras samplers. 2022-09-02 13:39:26 -04:00
Lincoln Stein
0b582a40d0 add developer's guidance for refactoring this change 2022-09-02 10:17:51 -04:00
gabrielrotbart
f4a19af04f fix scope being set to autocast even for m1 2022-09-02 14:55:24 +03:00
Kevin Gibbons
4fe265735a support generating variations
Co-authored-by: xra <mail@xra.dev>
2022-09-01 23:48:53 -07:00
Lincoln Stein
629ca09fda Merge branch 'dream-m1' of github.com:toffaletti/stable-diffusion into toffaletti-dream-m1
* Fix conflicts with main branch changes
* Fix logic error in choose_autocast_device() that was causing crashes
on CUDA systems.
2022-09-01 17:54:01 -04:00
Lincoln Stein
833de06299 fix InitImageResizer not found error, closes #294 2022-09-01 16:16:46 -04:00
Lincoln Stein
1b3c7acce3 fix ambiguous naming of self.device 2022-09-01 14:18:17 -04:00
Lincoln Stein
e6b2c15fc5 Merge branch 'main' into fit-init-img
add a --fit option to limit the size of the initial image to the
maximum boundaries specified by width and height.
2022-09-01 14:09:46 -04:00
Lincoln Stein
2455bb38a4
Remove redundant chain of types
torch->cuda and cuda->torch, so torch.cuda.torch.cuda actually works. However it looks like (and probably is) a typo.
2022-09-01 10:23:45 -04:00
Lincoln Stein
01e05a98de this fixes the inconsistent use of self.device, sometimes a str and sometimes an obj 2022-09-01 10:16:05 -04:00
Cora Johnson-Roberson
91565970c2 Move environment-mac.yaml to Python 3.9 and patch dream.py for Macs.
I'm using stable-diffusion on a 2022 Macbook M2 Air with 24 GB unified memory.
I see this taking about 2.0s/it.

I've moved many deps from pip to conda-forge, to take advantage of the
precompiled binaries. Some notes for Mac users, since I've seen a lot of
confusion about this:

One doesn't need the `apple` channel to run this on a Mac-- that's only
used by `tensorflow-deps`, required for running tensorflow-metal. For
that, I have an example environment.yml here:

https://developer.apple.com/forums/thread/711792?answerId=723276022#723276022

However, the `CONDA_ENV=osx-arm64` environment variable *is* needed to
ensure that you do not run any Intel-specific packages such as `mkl`,
which will fail with [cryptic errors](https://github.com/CompVis/stable-diffusion/issues/25#issuecomment-1226702274)
on the ARM architecture and cause the environment to break.

I've also added a comment in the env file about 3.10 not working yet.
When it becomes possible to update, those commands run on an osx-arm64
machine should work to determine the new version set.

Here's what a successful run of dream.py should look like:

```
$ python scripts/dream.py --full_precision                                                                                                           SIGABRT(6) ↵  08:42:59
* Initializing, be patient...

Loading model from models/ldm/stable-diffusion-v1/model.ckpt
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
Using slower but more accurate full-precision math (--full_precision)
>> Setting Sampler to k_lms
model loaded in 6.12s

* Initialization done! Awaiting your command (-h for help, 'q' to quit)
dream> "an astronaut riding a horse"
Generating:   0%|                                                                                                                                                                         | 0/1 [00:00<?, ?it/s]/Users/corajr/Documents/lstein/ldm/modules/embedding_manager.py:152: UserWarning: The operator 'aten::nonzero' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1662016319283/work/aten/src/ATen/mps/MPSFallback.mm:11.)
  placeholder_idx = torch.where(
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [01:37<00:00,  1.95s/it]
Generating: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:38<00:00, 98.55s/it]
Usage stats:
   1 image(s) generated in 98.60s
   Max VRAM used for this generation: 0.00G
Outputs:
outputs/img-samples/000001.1525943180.png: "an astronaut riding a horse" -s50 -W512 -H512 -C7.5 -Ak_lms -F -S1525943180
```
2022-09-01 09:04:30 -04:00
Jason Toffaletti
09bd9fa47e move autocast device selection to a function 2022-08-31 22:21:14 -07:00
Lincoln Stein
dc30adfbb4 closes #273, crash on M1 machines 2022-09-01 01:09:56 -04:00
Jason Toffaletti
fa98601bfb better error reporting for load_model 2022-08-31 22:03:50 -07:00
Jason Toffaletti
bf50ab9dd6 changes to get dream.py working on M1
- move all device init logic to T2I.__init__
- handle m1 specific edge case with autocast device type
- check torch.cuda.is_available before using cuda
2022-08-31 22:03:42 -07:00
Lincoln Stein
28fe84177e optionally scale initial image to fit box defined by width x height
* This functionality is triggered by the --fit option in the CLI (default
false), and by the "fit" checkbox in the WebGUI (default True)

* In addition, this commit contains a number of whitespace changes to
make the code more readable, as well as an attempt to unify the visual
appearance of info and warning messages.
2022-09-01 00:52:43 -04:00
blessedcoolant
0433b3d625
Add Warning When Image Is Too Large (#271)
* Add Warning When Image Is Too Large

* fix incomprehensible formatting introduced by "blue"

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-08-31 23:13:21 -04:00
Lincoln Stein
4b560b50c2
fix AttributeError crash when running on non-CUDA systems (#256)
* fix AttributeError crash when running on non-CUDA systems; closes issue #234 and issue #250
* although this prevents dream.py script from crashing immediately on MPS systems, MPS support still very much a work in progress.
2022-08-31 16:59:27 -04:00
Lincoln Stein
9ad79207c2 Merge branch 'main' of github.com:lstein/stable-diffusion into main 2022-08-31 14:44:18 -04:00
Lincoln Stein
0be2351c97 Merge branch 'resolution-checker' of https://github.com/blessedcoolant/stable-diffusion into main 2022-08-31 14:43:17 -04:00
_nderscore
c52ba1b022
feat: simplify and enhance prompt weight splitting (#258)
* feat: simplify and enhance prompt weight splitting

* fix: don't shadow the prompt variable

* feat: enable backslash-escaped colons in prompts
2022-08-31 14:00:10 -04:00
Mikhail Tishin
b622819051
Expose img2img strength parameter in Web UI (#239)
* Expose img2img strength parameter in Web UI

* Fix strength label id

Co-authored-by: Mikhail Tishin <michail.tishin@fayrix.com>
Co-authored-by: Kevin Gibbons https://github.com/bakkot
2022-08-31 11:18:32 -04:00
James Reynolds
a547c33327
check if torch.backends has mps before calling it (#245)
Co-authored-by: James Reynolds <magnsuviri@me.com>
2022-08-31 10:56:38 -04:00
Lincoln Stein
5354122094
Merge branch 'main' into refactor-pngwriter-2 2022-08-31 01:24:17 -04:00
spezialspezial
64444025a9
Update simplet2i.py (#228)
Typo causing bug when preinitializing the model. Unsupported Sampler: klms, Defaulting to plms
2022-08-31 01:08:46 -04:00
Kevin Gibbons
d566ee092a move make_grid into image_utils 2022-08-30 22:03:53 -07:00
Kevin Gibbons
b983d61e93 tweak format of "result" event in web ui 2022-08-30 22:03:53 -07:00
Kevin Gibbons
153c93bdd4 refactor pngwriter 2022-08-30 22:03:51 -07:00
Lincoln Stein
3be1cee17c avoid crash due to dangling batch_size reference 2022-08-31 00:56:12 -04:00
Lincoln Stein
bdb0651eb2 add support for Apple hardware using MPS acceleration 2022-08-31 00:33:23 -04:00
blessedcoolant
1480ef84dc Add Resolution Checker 2022-08-31 14:54:16 +12:00
Kevin Gibbons
1714816fe2
remove support for batch_size from dream.py (#227)
* remove dream.py support for batch_size

* expect to get a single image
2022-08-30 22:30:12 -04:00
Kevin Gibbons
8ca4d6542d
support progress for img2img (#215)
WebGUI shows progress bar when an initial image is provided.
2022-08-30 15:36:12 -04:00
Lincoln Stein
a51e18ea98
resize initial image to match requested width and height, preserving aspect ratio. Closes #210. Closes #207 (#214) 2022-08-30 15:26:02 -04:00
Kevin Gibbons
5d13207aa6 webui: support cancelation 2022-08-30 08:55:40 -07:00
Lincoln Stein
186d0f9d10 Merge branch 'sw-drop' of https://github.com/bakkot/stable-diffusion into bakkot-sw-drop 2022-08-30 09:17:07 -04:00
Lincoln Stein
19e4298cf9 Merge branch 'BlueAmulet-prompt_as_dir' into main
This adds the frequently-requested feature of naming the output
directory after the text prompt.
2022-08-29 22:34:48 -04:00
Lincoln Stein
42ffcd7204 add the recently added commands to the readline command-line-completion list; fix command-line documentation bug, closing issue #188 2022-08-29 22:34:09 -04:00
Kevin Gibbons
18597ad1d9 fix bug in pngwriter 2022-08-29 16:33:32 -07:00