Commit Graph

434 Commits

Author SHA1 Message Date
Peter Baylies
0891910cac * Updates for thresholding and perlin noise options, added warmup for thresholding. 2022-09-05 21:40:05 -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
Lincoln Stein
423d25716d
Fix unclosed code section 2022-09-02 18:04:15 -04:00
Lincoln Stein
1d999ba974
Fix reference to variations walkthru
Had wrong href for the VARIATIONS.md file
2022-09-02 18:01:52 -04:00
Lincoln Stein
27d4bb5624 Merge branch 'development' of github.com:lstein/stable-diffusion into development
Synchronize with earlier changes in development
2022-09-02 18:00:02 -04:00
Lincoln Stein
c78b496da6 Merge branch 'bakkot-seed-fuzz' into development
This adds support for variations and mixtures of weighted variations
2022-09-02 17:58:42 -04: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
Simon Vans-Colina
ad6cf6f2f7 Update readme to make it clearer for Windows users 2022-09-02 12:12:48 -04:00
Lincoln Stein
92d1ed744a Merge branch 'magnusviri-readme-mac-update-take2' into development 2022-09-02 10:42:39 -04:00
Lincoln Stein
da4bf95fbc
Merge branch 'development' into readme-mac-update-take2 2022-09-02 10:41:10 -04:00
James Reynolds
6ef7c1ad4e Added psychedelicious' changes 2022-09-02 08:29:28 -06:00
Lincoln Stein
33cc16473f Merge branch 'main' into development
Synchronizing dev with legacy pulls to main.
2022-09-02 10:22:57 -04:00
James Reynolds
1701c2ea94 README-Mac update 2022-09-02 10:22:26 -04:00
Lincoln Stein
2e299a1daf Merge branch 'gabrielrotbart-fix_img2img_m1' into main
This may improve the black image problem when using img2img with some
samplers on M1 hardware.
2022-09-02 10:18:06 -04:00
Lincoln Stein
0b582a40d0 add developer's guidance for refactoring this change 2022-09-02 10:17:51 -04:00
James Reynolds
1306457b27 README-Mac update 2022-09-02 08:17:19 -06: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
James Reynolds
2b7f32502c
Merge branch 'lstein:main' into main 2022-09-01 19:41:14 -06:00
Lincoln Stein
3ee82d8a3b Merge branch 'toffaletti-dream-m1' into main
This provides support for Apple M1 hardware
2022-09-01 17:55:36 -04: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
Brent Ozar
9e99fcbc16 README.md - fixing "further reading" formatting
Fixing typo in header and hyperlinking a file.
2022-09-01 10:27:58 -04:00
Lincoln Stein
346c9b66ec Merge branch 'corajr-main' into main
This improves Mac M1 installation instructions and makes the
environment easier to install.
2022-09-01 10:25:59 -04:00
Lincoln Stein
a52870684a Merge branch 'main' of https://github.com/corajr/stable-diffusion into corajr-main 2022-09-01 10:25:43 -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
2cac4697aa
Correct some verbiage in Mac readme. 2022-09-01 10:11:14 -04:00
Lincoln Stein
c5e95adb49 closes #273, crash on M1 machines 2022-09-01 10:01:41 -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
66fe110148 default full_prevision to True for mps device 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
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
James Reynolds
35d3f0ed90
Merge branch 'lstein:main' into main 2022-08-31 21:42:12 -06: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
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
_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
Lincoln Stein
d022d0dd11
continue to display in-progress image until the post-processing is done, for better esthetics (#255) 2022-08-31 12:32:56 -04:00