Commit Graph

151 Commits

Author SHA1 Message Date
blessedcoolant
42072fc15c Bug Fixes 2022-09-17 14:12:35 +12: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
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
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
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
a3e07fb84a fix grid crash 2022-09-12 07:28:58 -04:00
Lincoln Stein
0ab5a36464 fix missing lines in outputs 2022-09-11 17:19:46 -04:00
blessedcoolant
b86a1deb00
Remove print statement styling (#504)
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-11 15:47:12 -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
d301836fbd can select prior output for init_img using -1, -2, etc 2022-09-11 10:52:19 -04:00
Lincoln Stein
70aa674e9e merge PR #495 - keep using float16 in ldm.modules.attention 2022-09-11 10:34:06 -04:00
Lincoln Stein
8748370f44 negative -S indexing recovers correct previous seed; closes issue #476 2022-09-11 10:22:32 -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
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
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
Lincoln Stein
dd2aedacaf
report VRAM usage stats during initial model loading (#419) 2022-09-07 13:23:53 -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
Lincoln Stein
0f93dadd6a fix several dangling references to --gfpgan option, which no longer exists 2022-09-04 21:39:15 -04:00
Lincoln Stein
a01b7bdc40 add web interface for seamless option 2022-09-03 13:43:04 -04:00
Lincoln Stein
6566c2298c add scalable support for new models using a configs/models.yaml file 2022-09-03 11:45:21 -04:00
Lincoln Stein
063b4a1995 add ability to specify location of config file (models.yaml) 2022-09-03 11:36:04 -04:00
Lincoln Stein
91cce6b4c3 move special-casing test for precision on mps into T2I class 2022-09-03 09:43:18 -04:00
prixt
a61e49bc97 * Removed unnecessary code
* Added description about --seamless
2022-09-03 22:39:35 +09:00
Lincoln Stein
f46916d521 Add warning message about change in default host 2022-09-03 09:33:02 -04:00
Lincoln Stein
12755c6ef6 Merge branch 'web-host-port' of github.com:cgodley/stable-diffusion into cgodley-web-host-port
this allows host and port to be set on --web command line.
changes default binding from 0.0.0.0 to 127.0.0.1
2022-09-03 09:12:32 -04: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
Cragin Godley
2288412ef2
dream.py: fix indentation 2022-09-02 15:00:07 -04:00
Cragin Godley
6bff985496
dream.py: include 0.0.0.0 in --host help
Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-02 14:58:57 -04:00
Cragin Godley
918ade12ed
dream.py: use localhost in url when host is 0.0.0.0
Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-02 14:56:52 -04:00
Cragin Godley
68f62c8352 web: allow custom host/port, default to 127.0.0.1 for security reasons 2022-09-02 12:27:12 -04: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
David Wager
68eabab2af
Deprecate --laion400m and --weights arguments
Removes functionality for the --laion400m and --weights arguments and notifies user to use the --model argument instead.
2022-09-01 20:46:53 +01:00
David Wager
7db51d0171
Merge branch 'main' into main 2022-09-01 19:27:38 +01:00
Lincoln Stein
1b3c7acce3 fix ambiguous naming of self.device 2022-09-01 14:18:17 -04:00
David Wager
d319b8a762
Reference model from configs/models.yaml
By supplying --model (defaulting to stable-diffusion-1.4) a user can specify which model to load.
Width/Height/Config Location/Weights Location are referenced from configs/models.yaml
2022-09-01 19:04:31 +01: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
Lincoln Stein
c5e95adb49 closes #273, crash on M1 machines 2022-09-01 10:01:41 -04:00
Lincoln Stein
dc30adfbb4 closes #273, crash on M1 machines 2022-09-01 01:09:56 -04:00
Jason Toffaletti
66fe110148 default full_prevision to True for mps device 2022-08-31 22:03:50 -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
David Wager
ed513397b2
Allow configuration of which SD model to use (#263)
* Allow configuration of which SD model to use

Closes https://github.com/lstein/stable-diffusion/issues/49 The syntax isn't quite the same (opting for --weights over --model), although --weights is more in-line with the existing naming convention.
This method also locks us into models in the models/ldm/stable-diffusion-v1/ directory. Personally, I'm not averse to this, although a secondary solution may be necessary if we wish to supply weights from an external directory.

* Fix typo

* Allow either filename OR filepath input for arg

This approach allows both
--weights SD13 
--weights C:/StableDiffusion/models/ldm/stable-diffusion-v1/SD13.ckpt
2022-08-31 14:20:28 -04:00
Kevin Gibbons
d566ee092a move make_grid into image_utils 2022-08-30 22:03:53 -07:00
Kevin Gibbons
153c93bdd4 refactor pngwriter 2022-08-30 22:03:51 -07:00
Lincoln Stein
bdb0651eb2 add support for Apple hardware using MPS acceleration 2022-08-31 00:33:23 -04: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
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