Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
773cdabf
Commit
773cdabf
authored
Feb 09, 2023
by
comfyanonymous
Browse files
Same thing but for the other places where it's used.
parent
df40d4f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
comfy/ldm/modules/attention.py
comfy/ldm/modules/attention.py
+6
-1
comfy/ldm/modules/diffusionmodules/model.py
comfy/ldm/modules/diffusionmodules/model.py
+5
-1
No files found.
comfy/ldm/modules/attention.py
View file @
773cdabf
...
@@ -20,6 +20,11 @@ except:
...
@@ -20,6 +20,11 @@ except:
import
os
import
os
_ATTN_PRECISION
=
os
.
environ
.
get
(
"ATTN_PRECISION"
,
"fp32"
)
_ATTN_PRECISION
=
os
.
environ
.
get
(
"ATTN_PRECISION"
,
"fp32"
)
try
:
OOM_EXCEPTION
=
torch
.
cuda
.
OutOfMemoryError
except
:
OOM_EXCEPTION
=
Exception
def
exists
(
val
):
def
exists
(
val
):
return
val
is
not
None
return
val
is
not
None
...
@@ -316,7 +321,7 @@ class CrossAttentionDoggettx(nn.Module):
...
@@ -316,7 +321,7 @@ class CrossAttentionDoggettx(nn.Module):
r1
[:,
i
:
end
]
=
einsum
(
'b i j, b j d -> b i d'
,
s2
,
v
)
r1
[:,
i
:
end
]
=
einsum
(
'b i j, b j d -> b i d'
,
s2
,
v
)
del
s2
del
s2
break
break
except
torch
.
cuda
.
OutOfMemoryError
as
e
:
except
OOM_EXCEPTION
as
e
:
if
first_op_done
==
False
:
if
first_op_done
==
False
:
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
ipc_collect
()
torch
.
cuda
.
ipc_collect
()
...
...
comfy/ldm/modules/diffusionmodules/model.py
View file @
773cdabf
...
@@ -16,6 +16,10 @@ except:
...
@@ -16,6 +16,10 @@ except:
XFORMERS_IS_AVAILBLE
=
False
XFORMERS_IS_AVAILBLE
=
False
print
(
"No module 'xformers'. Proceeding without it."
)
print
(
"No module 'xformers'. Proceeding without it."
)
try
:
OOM_EXCEPTION
=
torch
.
cuda
.
OutOfMemoryError
except
:
OOM_EXCEPTION
=
Exception
def
get_timestep_embedding
(
timesteps
,
embedding_dim
):
def
get_timestep_embedding
(
timesteps
,
embedding_dim
):
"""
"""
...
@@ -229,7 +233,7 @@ class AttnBlock(nn.Module):
...
@@ -229,7 +233,7 @@ class AttnBlock(nn.Module):
r1
[:,
:,
i
:
end
]
=
torch
.
bmm
(
v
,
s2
)
r1
[:,
:,
i
:
end
]
=
torch
.
bmm
(
v
,
s2
)
del
s2
del
s2
break
break
except
torch
.
cuda
.
OutOfMemoryError
as
e
:
except
OOM_EXCEPTION
as
e
:
if
first_op_done
==
False
:
if
first_op_done
==
False
:
steps
*=
2
steps
*=
2
if
steps
>
128
:
if
steps
>
128
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment