diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-08 14:02:18 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-08 14:02:18 +0000 |
commit | dc1117233ef8f9b25ff1ac40b158f20b70ba2fcb (patch) | |
tree | d7b54aa4cd8216984bc842323cc880baff3065c3 /modules/sd_hijack_optimizations.py | |
parent | 7ff1170a2e11b6f00f587407326db0b9f8f51adf (diff) | |
download | stable-diffusion-webui-gfx803-dc1117233ef8f9b25ff1ac40b158f20b70ba2fcb.tar.gz stable-diffusion-webui-gfx803-dc1117233ef8f9b25ff1ac40b158f20b70ba2fcb.tar.bz2 stable-diffusion-webui-gfx803-dc1117233ef8f9b25ff1ac40b158f20b70ba2fcb.zip |
simplify xfrmers options: --xformers to enable and that's it
Diffstat (limited to 'modules/sd_hijack_optimizations.py')
-rw-r--r-- | modules/sd_hijack_optimizations.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/sd_hijack_optimizations.py b/modules/sd_hijack_optimizations.py index 05023b6f..d23d733b 100644 --- a/modules/sd_hijack_optimizations.py +++ b/modules/sd_hijack_optimizations.py @@ -1,4 +1,7 @@ import math
+import sys
+import traceback
+
import torch
from torch import einsum
@@ -7,13 +10,16 @@ from einops import rearrange from modules import shared
-try:
- import xformers.ops
- import functorch
- xformers._is_functorch_available = True
- shared.xformers_available = True
-except Exception:
- print('Cannot find xformers, defaulting to split attention. Try adding --xformers commandline argument to your webui-user file if you wish to install it.')
+if shared.cmd_opts.xformers:
+ try:
+ import xformers.ops
+ import functorch
+ xformers._is_functorch_available = True
+ shared.xformers_available = True
+ except Exception:
+ print("Cannot import xformers", file=sys.stderr)
+ print(traceback.format_exc(), file=sys.stderr)
+
# see https://github.com/basujindal/stable-diffusion/pull/117 for discussion
def split_cross_attention_forward_v1(self, x, context=None, mask=None):
|