Commit Graph

251 Commits

Author SHA1 Message Date
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
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
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
James Reynolds
70119602a0
Issue 270 fix (#274)
* check if torch.backends has mps before calling it

* Fixes issue 270

Co-authored-by: James Reynolds <magnsuviri@me.com>
2022-09-01 00:59:20 -04: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
David Ford
58e3562652
Fix merging embeddings (#226)
Fixed merging embeddings based on the changes made in textual inversion. Tested and working. Inverted their logic to prioritize Stable Diffusion implementation over alternatives, but left the option for alternatives to still be used.
2022-08-31 11:24:11 -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
Lincoln Stein
d48299e56c Merge branch 'prompt_as_dir' of https://github.com/BlueAmulet/stable-diffusion into BlueAmulet-prompt_as_dir 2022-08-29 22:13:37 -04:00
BlueAmulet
2e22d9ecf1 Address bakkot review 2022-08-29 18:10:15 -06:00
BlueAmulet
4f8e7356b3 Add prompt as output directory feature
Based on previous code by czyz
2022-08-29 14:52:02 -06:00
Lincoln Stein
7fe7cdc8c9
Merge pull request #176 from xraxra/show-tokenization
Print out tokenization data during image generation, allowing truncated prompts to be visible.
2022-08-29 15:36:10 -04:00
Lincoln Stein
63178c6a8c
Merge branch 'main' into patch-1 2022-08-29 15:12:14 -04:00
Lincoln Stein
38701a6d7b Fix IndexError when generating grid; --grid option can now be passed on shell command line 2022-08-29 13:52:44 -04:00
Lincoln Stein
c7db038c96 grid is broken, needs the grid-fix PR#166 to fix 2022-08-29 13:39:20 -04:00
xra
fef632e0e1 tokenization logging (take 2)
This adds an option -t argument that will print out color-coded tokenization, SD has a maximum of 77 tokens, it silently discards tokens over the limit if your prompt is too long.
By using -t you can see how your prompt is being tokenized which helps prompt crafting.
2022-08-29 12:28:49 +09:00
Kevin Gibbons
7ae79b350e write log files in utf-8, not ascii 2022-08-28 20:00:11 -07:00
Benjamin Warner
529040708b Fix grid image saving, log to outdir path, display sampler options once 2022-08-28 19:34:55 -05:00
Lincoln Stein
b85773f332 resolved conflicts and write properly-formatted prompt string (with sampler & upscaling) into image file 2022-08-28 19:01:45 -04:00
Lincoln Stein
8bbe7936bd close Issue #165 2022-08-28 18:21:20 -04:00
Lincoln Stein
7c485a1a4a adjusted -U upscaling argument so that it defaults to upscaling strength 0.75 if the second argument is not given 2022-08-28 17:26:39 -04:00
Lincoln Stein
ea2ee33be8 cosmetic fixup to how the outputs are reported 2022-08-28 17:06:33 -04:00
Lincoln Stein
7dfca3dcb5 moved scripts/dream_server.py into ldm/dream/server.py 2022-08-28 16:37:27 -04:00
blessedcoolant
614974a8e8
Merge branch 'main' into gfpgan-optimization 2022-08-29 08:22:26 +12:00
blessedcoolant
6e49c070bb Optimize and Improve GFPGAN and Real-ESRGAN Pipeline 2022-08-29 08:14:29 +12:00
Lincoln Stein
042a9043d1 got rid of the cd and pwd commands, and just allow user to specify --outdir on the command 2022-08-28 15:54:12 -04:00
Lincoln Stein
3b2569ebdd Merge branch 'yunsaki-main' into main 2022-08-28 14:20:48 -04:00
Lincoln Stein
8b9a520c5c adjusted handling of from_file 2022-08-28 14:20:34 -04:00
Lincoln Stein
ba03289c14 print current and max VRAM usage stats after each round of generation 2022-08-28 13:05:01 -04:00
blessedcoolant
d1551b1bd4 Enable users to set sampler using prompts 2022-08-29 04:27:54 +12:00
Andy Pilate
fab9e1a423
Fix wrong help message 2022-08-28 17:11:24 +02:00
yun saki
7040995ceb fixed variable name error 2022-08-26 14:25:49 +02:00
yun saki
89805a5239 fixed mistake in comment 2022-08-26 13:25:12 +02:00
yun saki
e00397f9ca refactored logfile handling; minimised time spent in context managers (with open) 2022-08-26 13:22:53 +02:00
yun saki
12f59e1daa removed log.close(); 'with open' automatically closes the file 2022-08-26 13:12:56 +02:00
yun saki
cf750f62db refactored infile handling 2022-08-26 13:10:37 +02:00
yun saki
0f28663805 remove redundant None check (if var does the same thing) 2022-08-26 12:43:13 +02:00
Sean McLellan
eb9f0be91a Set default to none for gfpgan_strength 2022-08-26 03:53:55 -04:00
Lincoln Stein
4f02b72c9c prettified all the code using "blue" at the urging of @tildebyte 2022-08-26 03:15:42 -04:00
Lincoln Stein
dd670200bb documentation tweaks for installation and running of the GFPGAN extension; now you have the ability to specify the previous image's seed with -S -1, the one before that with -S -2, and so forth 2022-08-26 02:17:14 -04:00
Lincoln Stein
8f89a2456a something is not quite right; when providing -G1 option on one prompt, and then omitting it on the next, I see a "images do not match" error from GFPGAN 2022-08-26 01:20:01 -04:00
Sean McLellan
470a62dbbe Merge branch 'main' of https://github.com/BaristaLabs/stable-diffusion-dream into add-gfpgan-option 2022-08-26 00:26:03 -04:00
Sean McLellan
cb86b9ae6e Remove the redundancy, better logging 2022-08-25 23:48:35 -04:00
Sean McLellan
3a30a8f2d2 Fix not being able to disable bgupscaler; update readme 2022-08-25 23:39:03 -04:00
Sean McLellan
60ed004328 Update readme, fix defaults for case-sensitive fs's 2022-08-25 23:31:08 -04:00
Sean McLellan
dbb9132f4d Merge branch 'main' of https://github.com/BaristaLabs/stable-diffusion-dream into add-gfpgan-option 2022-08-25 23:19:17 -04:00
Sean McLellan
5711b6d611 Add optional GFPGAN support 2022-08-25 22:57:30 -04:00
Lincoln Stein
f1bed52530 moved dream utilities into their own subfolder 2022-08-25 22:49:15 -04:00
Lincoln Stein
c38b6964b4 improved inline error messages slightly 2022-08-25 22:19:12 -04:00
tesseractcat
b49475a54f Keep a log of requests for dream_web 2022-08-25 21:06:17 -04:00
Lincoln Stein
19fa222810 refactoring complete; please test carefully! 2022-08-25 17:30:08 -04:00
Lincoln Stein
b3e3b0e861 feature complete; looks like ready for merge 2022-08-25 17:26:48 -04:00
Lincoln Stein
2114c386ad moved index.js .html and .css files into static/dream_web/; changed batch to iterations again 2022-08-25 15:27:43 -04:00
Lincoln Stein
d04518e65e resolved conflicts in use of batch vs iterations 2022-08-25 15:14:38 -04:00
Lincoln Stein
4ec21a5423 resolved conflicts 2022-08-25 15:09:55 -04:00
Lincoln Stein
2ada3288e7 Small cleanups.
- Quenched tokenizer warnings during model initialization.
- Changed "batch" to "iterations" for generating multiple images in
  order to conserve vram.
- Updated README.
- Moved static folder from under scripts to top level. Can store other
  static content there in future.
- Added screenshot of web server in action (to static folder).
2022-08-25 15:03:40 -04:00
tesseractcat
91966e9ffa Fix appearance on mobile 2022-08-25 15:01:08 -04:00
tesseractcat
2ad73246f9 Normalize working directory 2022-08-25 14:27:33 -04:00
tesseractcat
d3a802db69 Fix horizontal divider 2022-08-25 14:18:29 -04:00
tesseractcat
b95908daec Move style and script to individual files 2022-08-25 14:15:08 -04:00
Lincoln Stein
79add5f0b6 Merge branch 'main' of https://github.com/TesseractCat/stable-diffusion into TesseractCat-main 2022-08-25 13:52:44 -04:00
BlueAmulet
39b55ae016 Remove accelerate library
This library is not required to use k-diffusion
Make k-diffusion wrapper closer to the other samplers
2022-08-25 11:04:57 -06:00
tesseractcat
72a9d75330 404 on missing file 2022-08-25 01:25:22 -04:00
Lincoln Stein
0b4459b707 mostly back to full functionality; just missing grid generation code 2022-08-25 00:42:37 -04:00
tesseractcat
ab131cb55e Add img2img support, fix naming conventions 2022-08-24 23:03:02 -04:00
tesseractcat
269fcf92d9 Reapply prompt config on image click 2022-08-24 21:38:47 -04:00
Lincoln Stein
b978536385 code is reorganized and mostly functional. Grid needs to be brought back online, as well as naming of img2img variants (currently the variants get written but not logged) 2022-08-24 19:47:59 -04:00
tesseractcat
0a7fe6f2d9 Switch to ThreadingHTTPServer 2022-08-24 18:19:50 -04:00
Lincoln Stein
b12955c963 remove unneeded imports from dream.py 2022-08-24 17:57:44 -04:00
Lincoln Stein
9133087850 first draft at big refactoring; will be broken 2022-08-24 17:52:34 -04:00
tesseractcat
df9f088eb4 Preserve prompt across generations 2022-08-24 17:28:59 -04:00
tesseractcat
b1600d4ca3 Update seed on click 2022-08-24 17:26:22 -04:00
tesseractcat
0efc3bf780 Add bare bones web UI 2022-08-24 17:04:30 -04:00
Sean McLellan
dd16fe16bb Fix issue where more than the expected number of variants are generated 2022-08-24 16:26:58 -04:00
Lincoln Stein
1eec6b776b tweaked documentation and comments slightly 2022-08-24 15:25:52 -04:00
Lincoln Stein
776c747978 added warning message when width/height specified along with init img 2022-08-24 14:04:27 -04:00
Sean McLellan
ee10021ea2 bikeshedding 2022-08-24 13:36:27 -04:00
Sean McLellan
ca82acfd3b Remove unnecessary print, small optmi 2022-08-24 13:33:19 -04:00
Sean McLellan
feea5fb063 Merge branch 'main' of https://github.com/BaristaLabs/stable-diffusion-dream into add-simple-variant-mechanism 2022-08-24 13:16:15 -04:00
Sean McLellan
b5cdbd3b0b Fixes issue with cuda/current mismatch 2022-08-24 13:14:08 -04:00
Lincoln Stein
47a5da25b7 runtime errors now produce a stack trace 2022-08-24 12:57:04 -04:00
Sean McLellan
c6b5e930dc Merge branch 'main' of https://github.com/BaristaLabs/stable-diffusion-dream into add-simple-variant-mechanism 2022-08-24 12:06:29 -04:00
Sean McLellan
d33e1bf563 Add simple way to make variants 2022-08-24 12:02:36 -04:00
Lincoln Stein
c24a16ccb0 resolved merge conflicts 2022-08-24 11:50:48 -04:00
Lincoln Stein
37609d6e53 resolved merge conflicts 2022-08-24 11:42:44 -04:00
Lincoln Stein
9050ce152b Fixed up a few merge conflicts, looks good so far 2022-08-24 11:29:32 -04:00
Lincoln Stein
decd1a58d2 Merge branch 'escape-single-quotes' into main
This prevents single quotes in the prompt from generating a parse error.
2022-08-24 11:21:09 -04:00
Lincoln Stein
7f4a5e946d Merge branch 'tildebyte-feat-samplers-add-remaining-k' into main
This adds the remaining k_* samplers to the dream.py script.
2022-08-24 11:19:45 -04:00
Lincoln Stein
4bc64a6aff sampler now written to PNG metadata 2022-08-24 11:18:51 -04:00
Lincoln Stein
3393b8cad1 added assertion checks for out-of-bound arguments; added various copyright and license agreement files 2022-08-24 09:22:27 -04:00
Sean McLellan
1df1e5c38b Test for the presence of the specified img2img 2022-08-23 19:22:35 -04:00
Sean McLellan
8952196bbf Add personalization 2022-08-23 18:26:28 -04:00
Ben Alkov
050dffd269 feat(samplers): add ability use all k_* samplers
Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
2022-08-23 17:26:22 -04:00
Benjamin Warner
de1cea92ce Small QoL imporvements 2022-08-23 12:49:17 -05:00
Lincoln Stein
3a58988e4a escape single quotes in the command stream so as not to confuse the shlex parser 2022-08-23 13:46:50 -04:00
Lincoln Stein
716dbbdf8c resolved conflicts in README changelog 2022-08-23 10:40:22 -04:00
Lincoln Stein
1f2e52a1d6 fixed filename generation so that newer files are always chronologically later 2022-08-23 10:39:18 -04:00
Lincoln Stein
11c0df07b7 prompt weighting not working 2022-08-23 01:23:14 -04:00
Lincoln Stein
710b908290 Keyboard interrupt retains seed and log information in files produced prior to interrupt. Closes #21 2022-08-23 00:51:38 -04:00
Lincoln Stein
bc7b1fdd37 Added --from_file argument to load input from a file. Closes #23 2022-08-23 00:30:06 -04:00
Lincoln Stein
6d1219deec fixed filenames 2022-08-22 23:56:36 -04:00
Lincoln Stein
e019de34ac can now change output directories in mid-session using cd and pwd commands 2022-08-22 21:14:31 -04:00
Lincoln Stein
88563fd27a added support for cd command in path completer 2022-08-22 21:01:06 -04:00
Lincoln Stein
e70169257e better exception handling for out of memory errors and badly formatted prompts 2022-08-22 16:55:06 -04:00
Lincoln Stein
a20827697c adjusted instructions for the released stable-diffusion-v1 weights 2022-08-22 15:33:27 -04:00
Lincoln Stein
9391eaff0e Merge branch 'prompt-in-png' into main 2022-08-22 13:24:12 -04:00
Lincoln Stein
e1d52822c5 fixed crash that occurs if you type an empty prompt at the dream> prompt 2022-08-22 12:40:54 -04:00
xra
e4eb775b63 added optional parameter to skip subprompt weight normalization
allows more control when fine-tuning
2022-08-23 00:03:32 +09:00
Lincoln Stein
63989ce6ff tidied up scripts directory by moving the original CompViz scripts into a subfolder 2022-08-22 10:11:54 -04:00
Lincoln Stein
aa2729d868 user's prompt is now normalized for reproducibility and written into the destination PNG file as a tEXt metadata chunk named "Dream". You can retrieve the prompt with an image editing program that supports browsing the full metadata, or with the images2prompt.py script located in 'scripts' 2022-08-22 00:12:16 -04:00
Lincoln Stein
5f352aec87 test of normalization of prompt 2022-08-21 22:48:40 -04:00
Lincoln Stein
78aba5b770 preparing for merge into main 2022-08-21 19:57:48 -04:00
Lincoln Stein
d340afc9e5 Merge branch 'main' of https://github.com/hwharrison/stable-diffusion into hwharrison-main 2022-08-21 16:32:31 -04:00
Lincoln Stein
7085d1910b set sys.path to include "." before loading simplet1i module 2022-08-21 11:03:22 -04:00
henry
503f962f68 ntpath doesn't have append, use join instead 2022-08-20 22:38:56 -05:00
henry
41f0afbcb6 add klms sampling 2022-08-20 22:28:29 -05:00
Lincoln Stein
6650b98e7c close #11 2022-08-20 19:49:12 -04:00
Lincoln Stein
1ca3dc553c added "." directory to sys path to prevent ModuleNotFound error on ldm.simplet2i that some Windows users have experienced 2022-08-20 19:46:54 -04:00
Lincoln Stein
0cea751476 remove shebang line from scripts; suspected culprit in Windows "module ldm.simplet2i not found" error 2022-08-19 06:33:42 -04:00
Lincoln Stein
4cb5fc5ed4 changed default output directory to outputs/img-samples because the same directory is now used for both txt2img and img2img 2022-08-18 23:23:44 -04:00
Lincoln Stein
d8926fb8c0 indentation error prevented filenames from printing 2022-08-18 23:15:03 -04:00
Lincoln Stein
80c0e30099 intercept keyboard interrupt during processing and return to prompt;
remove "!dream" from beginning of prompt;
user can quit by typing <q>
2022-08-18 23:03:22 -04:00
Lincoln Stein
ac440a1197 disable readline functionality on windows 2022-08-18 16:00:44 -04:00
Lincoln Stein
87fb4186d4 folded in changes from img2img-dev 2022-08-18 12:45:02 -04:00
Lincoln Stein
750408f793 added command-line completion 2022-08-18 12:43:59 -04:00
Lincoln Stein
bf76c4f283 img2img is now working; small refactoring of grid code in simplet2i.py 2022-08-18 10:47:53 -04:00
Lincoln Stein
831bbd7a54 improved error reporting when a missing online dependency can't be downloaded 2022-08-17 18:06:30 -04:00
Lincoln Stein
c477525036 catch and handle malformed user inputs; documentation fixes 2022-08-17 12:35:49 -04:00
Lincoln Stein
a7532b386a simplified instructions to preload Bert and kornia prerequisites; fixed --grid and --batch handling; added timing information after image generation 2022-08-17 12:00:00 -04:00
Lincoln Stein
fab1ae8685 create image output directory if it doesn't exist 2022-08-16 22:49:47 -04:00
Lincoln Stein
ef605de7af wording fix 2022-08-16 22:24:53 -04:00
Lincoln Stein
6126f09c04 fixed help text returned by dream.py 2022-08-16 22:23:24 -04:00
Lincoln Stein
d6124c44a3 added customized patches and updated the README 2022-08-16 21:34:37 -04:00
Robin Rombach
2ff270f4e0 stable diffusion 2022-08-10 16:30:49 +02:00
ablattmann
171cf29fb5 add configs for training unconditional/class-conditional ldms 2021-12-22 15:57:23 +01:00
Patrick Esser
32a9661b4e add inpainting model 2021-12-21 11:35:45 +00:00