Commit Graph

231 Commits

Author SHA1 Message Date
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
blessedcoolant
d80fff70f2 ESRGAN Improvements 2022-09-26 03:28:23 -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
Lincoln Stein
66896dcbbe
Merge branch 'development' into patch-2 2022-09-25 08:28:55 -04:00
H4rk
af8d73a8e8
Update dream.py
In the case of this "point", the Warp Terminal cannot be clicked directly to trigger the browser to open, and Chrome is a blank page. It should open properly once you remove it
2022-09-25 18:04:56 +08:00
blessedcoolant
53b4c3cc60 Upgrade GFPGAN to Version 1.4 2022-09-24 05:09:45 -04:00
blessedcoolant
660641e720 Missing ux warning 2022-09-23 13:17:06 +02:00
blessedcoolant
cd8be1d0e9 Restoration Modules are now optional 2022-09-23 10:51:41 +02: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
psychedelicious
28f06c7200 Reverts divergent fix to resto module path 2022-09-21 11:18:09 -04:00
blessedcoolant
8c751d342d Bug Fix Patch 2022-09-21 11:18:09 -04:00
blessedcoolant
069f91f930 Bug Fix Patch 2022-09-21 10:07:43 -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
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
psychedelicious
810112577f Fixes #717 2022-09-20 19:14:20 -04:00
Lincoln Stein
fc61ddab3c
Merge branch 'development' into postprocessing-commands 2022-09-20 18:48:42 -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
冯不游
30de9fcfae switch to ldm.dream.log 2022-09-20 16:54:50 -04:00
冯不游
a28636dd4a add markdown log option 2022-09-20 16:54:50 -04:00
Joseph Dries III
27b238999f Use model_url instead of model_path for gfpgan and CodeFormer. Fixes lstein/stable-diffusion#678 2022-09-20 07:15:54 -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
blessedcoolant
7b0cbb34d6 GFPGAN and Real ESRGAN Implementation Refactor 2022-09-19 23:38:56 +12:00
tildebyte
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
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
Lincoln Stein
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
Lincoln Stein
b68cb521ba
restore ability to save files to directories named after prompt (#654) 2022-09-18 08:37:08 -04:00
Lincoln Stein
239f41f3e0 add sd-metadata metadata_loads() and metadata_dumps() functions 2022-09-17 13:28:37 -04:00
Lincoln Stein
2faa116238 tidy up generation of prompt when variations in use 2022-09-17 11:59:47 -04:00
Lincoln Stein
31daf1f0d7 preload_models.py now downloads gfpgan model 2022-09-17 01:32:31 -04:00
Lincoln Stein
5b692f4720 include width and height in png dream prompt 2022-09-17 01:14:00 -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
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
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
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
Dominic Letz
340189fa0d fixup 2022-09-15 15:52:36 +02:00
Dominic Letz
8d2afefe6a fixup 2022-09-15 15:45:48 +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