aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sub_quadratic_attention.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some deprecated typesa6662023-08-291-2/+2
|
* `torch.empty` can create issues; use `torch.zeros`brkirch2023-08-131-2/+2
| | | | For MPS, using a tensor created with `torch.empty()` can cause `torch.baddbmm()` to include NaNs in the tensor it returns, even though `beta=0`. However, with a tensor of shape [1,1,1], there should be a negligible performance difference between `torch.empty()` and `torch.zeros()` anyway, so it's better to just use `torch.zeros()` for this and avoid unnecessarily creating issues.
* Autofix Ruff W (not W605) (mostly whitespace)Aarni Koskela2023-05-111-1/+1
|
* repair #10266AUTOMATIC2023-05-111-13/+5
|
* Update sub_quadratic_attention.pyLouis Del Valle2023-05-111-6/+15
| | | | | | | 1. Determine the number of query chunks. 2. Calculate the final shape of the res tensor. 3. Initialize the tensor with the calculated shape and dtype, (same dtype as the input tensors, usually) Can initialize the tensor as a zero-filled tensor with the correct shape and dtype, then compute the attention scores for each query chunk and fill the corresponding slice of tensor.
* Add UI setting for upcasting attention to float32brkirch2023-01-251-2/+2
| | | | | | Adds "Upcast cross attention layer to float32" option in Stable Diffusion settings. This allows for generating images using SD 2.1 models without --no-half or xFormers. In order to make upcasting cross attention layer optimizations possible it is necessary to indent several sections of code in sd_hijack_optimizations.py so that a context manager can be used to disable autocast. Also, even though Stable Diffusion (and Diffusers) only upcast q and k, unfortunately my findings were that most of the cross attention layer optimizations could not function unless v is upcast also.
* Remove fallback for Protocol import and remove Protocol import and remove ↵AUTOMATIC2023-01-091-8/+11
| | | | | | instances of Protocol in code add some whitespace between functions to be in line with other code in the repo
* Add fallback for Protocol importProGamerGov2023-01-071-1/+7
|
* Added licensebrkirch2023-01-061-1/+1
|
* Use narrow instead of dynamic_slicebrkirch2023-01-061-15/+19
|
* Add Birch-san's sub-quadratic attention implementationbrkirch2023-01-061-0/+201