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
1e2839f4
Commit
1e2839f4
authored
Jun 20, 2024
by
comfyanonymous
Browse files
More proper tiled audio decoding.
parent
d5efde89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
comfy/sd.py
comfy/sd.py
+13
-4
No files found.
comfy/sd.py
View file @
1e2839f4
...
@@ -299,15 +299,24 @@ class VAE:
...
@@ -299,15 +299,24 @@ class VAE:
return
output
return
output
def
decode_tiled_1d
(
self
,
samples
,
tile_x
=
128
,
overlap
=
64
):
def
decode_tiled_1d
(
self
,
samples
,
tile_x
=
128
,
overlap
=
64
):
output
=
torch
.
empty
((
samples
.
shape
[
0
],
self
.
output_channels
)
+
tuple
(
map
(
lambda
a
:
a
*
self
.
upscale_ratio
,
samples
.
shape
[
2
:])),
device
=
self
.
output_device
)
output
=
torch
.
zeros
((
samples
.
shape
[
0
],
self
.
output_channels
)
+
tuple
(
map
(
lambda
a
:
a
*
self
.
upscale_ratio
,
samples
.
shape
[
2
:])),
device
=
self
.
output_device
)
output_mult
=
torch
.
zeros
((
samples
.
shape
[
0
],
self
.
output_channels
)
+
tuple
(
map
(
lambda
a
:
a
*
self
.
upscale_ratio
,
samples
.
shape
[
2
:])),
device
=
self
.
output_device
)
for
j
in
range
(
samples
.
shape
[
0
]):
for
j
in
range
(
samples
.
shape
[
0
]):
for
i
in
range
(
0
,
samples
.
shape
[
-
1
],
tile_x
-
overlap
):
for
i
in
range
(
0
,
samples
.
shape
[
-
1
],
tile_x
-
overlap
):
f
=
i
f
=
i
t
=
i
+
tile_x
t
=
i
+
tile_x
output
[
j
:
j
+
1
,:,
f
*
self
.
upscale_ratio
:
t
*
self
.
upscale_ratio
]
=
self
.
first_stage_model
.
decode
(
samples
[
j
:
j
+
1
,:,
f
:
t
].
to
(
self
.
vae_dtype
).
to
(
self
.
device
)).
float
()
o
=
output
[
j
:
j
+
1
,:,
f
*
self
.
upscale_ratio
:
t
*
self
.
upscale_ratio
]
m
=
torch
.
ones_like
(
o
)
return
output
l
=
m
.
shape
[
-
1
]
for
x
in
range
(
overlap
):
c
=
((
x
+
1
)
/
overlap
)
m
[:,:,
x
:
x
+
1
]
*=
c
m
[:,:,
l
-
x
-
1
:
l
-
x
]
*=
c
o
+=
self
.
first_stage_model
.
decode
(
samples
[
j
:
j
+
1
,:,
f
:
t
].
to
(
self
.
vae_dtype
).
to
(
self
.
device
)).
float
().
to
(
self
.
output_device
)
*
m
output_mult
[
j
:
j
+
1
,:,
f
*
self
.
upscale_ratio
:
t
*
self
.
upscale_ratio
]
+=
m
return
output
/
output_mult
def
encode_tiled_
(
self
,
pixel_samples
,
tile_x
=
512
,
tile_y
=
512
,
overlap
=
64
):
def
encode_tiled_
(
self
,
pixel_samples
,
tile_x
=
512
,
tile_y
=
512
,
overlap
=
64
):
steps
=
pixel_samples
.
shape
[
0
]
*
comfy
.
utils
.
get_tiled_scale_steps
(
pixel_samples
.
shape
[
3
],
pixel_samples
.
shape
[
2
],
tile_x
,
tile_y
,
overlap
)
steps
=
pixel_samples
.
shape
[
0
]
*
comfy
.
utils
.
get_tiled_scale_steps
(
pixel_samples
.
shape
[
3
],
pixel_samples
.
shape
[
2
],
tile_x
,
tile_y
,
overlap
)
...
...
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