Commit Graph

840 Commits

Author SHA1 Message Date
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
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
James Reynolds
33936430d0 Added issue templates 2022-09-02 12:16:09 -04:00
James Reynolds
81b3de9c65 New issue template 2022-09-02 12:16:09 -04:00
Simon Vans-Colina
ad6cf6f2f7 Update readme to make it clearer for Windows users 2022-09-02 12:12:48 -04:00
Eric Khun
ecef72ca39
Merge branch 'development' into patch-1 2022-09-02 15:22:30 +00: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
Lincoln Stein
d43c5c01e3
Update README.md
Those []() link pairs get me every time.
2022-09-02 10:38:59 -04:00
Lincoln Stein
51278c7a10 add brief contribution instructions in lieu of full code-of-conduct and contribution guidelines 2022-09-02 10:37:35 -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
Eric Khun
58545ba057
Update README-Mac-MPS.md 2022-09-02 19:52:13 +08: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
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
a4f69e62d7
Set sensible default for 1.4
Use the file that already exists for the majority of users for the default value.
2022-09-01 20:21:39 +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
David Wager
db580ccefd
Create models.yaml
models.yaml can serve as a base for expanding our support for other versions of Latent/Stable Diffusion.
Contained are parameters for default width/height, as well as where to find the config and weights for this model.
Adding a new model is as simple as adding to this file.
2022-09-01 19:02:57 +01: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