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
c692509c
Commit
c692509c
authored
Mar 22, 2023
by
comfyanonymous
Browse files
Try to improve VAEEncode memory usage a bit.
parent
a3ba90d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
comfy/ldm/modules/diffusionmodules/model.py
comfy/ldm/modules/diffusionmodules/model.py
+3
-5
No files found.
comfy/ldm/modules/diffusionmodules/model.py
View file @
c692509c
...
...
@@ -616,19 +616,17 @@ class Encoder(nn.Module):
x
=
torch
.
nn
.
functional
.
pad
(
x
,
pad
,
mode
=
"constant"
,
value
=
0
)
already_padded
=
True
# downsampling
h
s
=
[
self
.
conv_in
(
x
)
]
h
=
self
.
conv_in
(
x
)
for
i_level
in
range
(
self
.
num_resolutions
):
for
i_block
in
range
(
self
.
num_res_blocks
):
h
=
self
.
down
[
i_level
].
block
[
i_block
](
h
s
[
-
1
]
,
temb
)
h
=
self
.
down
[
i_level
].
block
[
i_block
](
h
,
temb
)
if
len
(
self
.
down
[
i_level
].
attn
)
>
0
:
h
=
self
.
down
[
i_level
].
attn
[
i_block
](
h
)
hs
.
append
(
h
)
if
i_level
!=
self
.
num_resolutions
-
1
:
h
s
.
append
(
self
.
down
[
i_level
].
downsample
(
h
s
[
-
1
]
,
already_padded
)
)
h
=
self
.
down
[
i_level
].
downsample
(
h
,
already_padded
)
already_padded
=
False
# middle
h
=
hs
[
-
1
]
h
=
self
.
mid
.
block_1
(
h
,
temb
)
h
=
self
.
mid
.
attn_1
(
h
)
h
=
self
.
mid
.
block_2
(
h
,
temb
)
...
...
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