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
d935ba50
Commit
d935ba50
authored
Aug 27, 2023
by
comfyanonymous
Browse files
Make --bf16-vae work on torch 2.0
parent
412596d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
comfy/ldm/modules/diffusionmodules/model.py
comfy/ldm/modules/diffusionmodules/model.py
+12
-1
No files found.
comfy/ldm/modules/diffusionmodules/model.py
View file @
d935ba50
...
...
@@ -56,7 +56,18 @@ class Upsample(nn.Module):
padding
=
1
)
def
forward
(
self
,
x
):
try
:
x
=
torch
.
nn
.
functional
.
interpolate
(
x
,
scale_factor
=
2.0
,
mode
=
"nearest"
)
except
:
#operation not implemented for bf16
b
,
c
,
h
,
w
=
x
.
shape
out
=
torch
.
empty
((
b
,
c
,
h
*
2
,
w
*
2
),
dtype
=
x
.
dtype
,
layout
=
x
.
layout
,
device
=
x
.
device
)
split
=
8
l
=
out
.
shape
[
1
]
//
split
for
i
in
range
(
0
,
out
.
shape
[
1
],
l
):
out
[:,
i
:
i
+
l
]
=
torch
.
nn
.
functional
.
interpolate
(
x
[:,
i
:
i
+
l
].
to
(
torch
.
float32
),
scale_factor
=
2.0
,
mode
=
"nearest"
).
to
(
x
.
dtype
)
del
x
x
=
out
if
self
.
with_conv
:
x
=
self
.
conv
(
x
)
return
x
...
...
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