aboutsummaryrefslogtreecommitdiffstats
path: root/modules/xpu_specific.py
diff options
context:
space:
mode:
authorNuullll <vfirst218@gmail.com>2023-12-09 10:09:45 +0000
committerNuullll <vfirst218@gmail.com>2023-12-09 10:09:45 +0000
commit59429793440fb3cb1624ddcc702c6f9807373203 (patch)
tree4cc9d1961ca2dd9a530225116289d6d14cb2adb7 /modules/xpu_specific.py
parent746783f7a47f38f728f221cc26fe04035d3ca66b (diff)
downloadstable-diffusion-webui-gfx803-59429793440fb3cb1624ddcc702c6f9807373203.tar.gz
stable-diffusion-webui-gfx803-59429793440fb3cb1624ddcc702c6f9807373203.tar.bz2
stable-diffusion-webui-gfx803-59429793440fb3cb1624ddcc702c6f9807373203.zip
Fix ControlNet
Diffstat (limited to 'modules/xpu_specific.py')
-rw-r--r--modules/xpu_specific.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/xpu_specific.py b/modules/xpu_specific.py
index ec1ad100..9bb0a561 100644
--- a/modules/xpu_specific.py
+++ b/modules/xpu_specific.py
@@ -51,3 +51,9 @@ if has_xpu:
CondFunc('torch.bmm',
lambda orig_func, input, mat2, out=None: orig_func(input.to(mat2.dtype), mat2, out=out),
lambda orig_func, input, mat2, out=None: input.dtype != mat2.dtype)
+ CondFunc('torch.cat',
+ lambda orig_func, tensors, dim=0, out=None: orig_func([t.to(tensors[0].dtype) for t in tensors], dim=dim, out=out),
+ lambda orig_func, tensors, dim=0, out=None: not all(t.dtype == tensors[0].dtype for t in tensors))
+ CondFunc('torch.nn.functional.scaled_dot_product_attention',
+ lambda orig_func, query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False: orig_func(query, key.to(query.dtype), value.to(query.dtype), attn_mask, dropout_p, is_causal),
+ lambda orig_func, query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False: query.dtype != key.dtype or query.dtype != value.dtype) \ No newline at end of file