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
58c98382
Commit
58c98382
authored
May 24, 2024
by
comfyanonymous
Browse files
Speed up TAESD preview.
parent
b02bcced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
latent_preview.py
latent_preview.py
+2
-3
No files found.
latent_preview.py
View file @
58c98382
...
@@ -25,9 +25,8 @@ class TAESDPreviewerImpl(LatentPreviewer):
...
@@ -25,9 +25,8 @@ class TAESDPreviewerImpl(LatentPreviewer):
def
decode_latent_to_preview
(
self
,
x0
):
def
decode_latent_to_preview
(
self
,
x0
):
x_sample
=
self
.
taesd
.
decode
(
x0
[:
1
])[
0
].
detach
()
x_sample
=
self
.
taesd
.
decode
(
x0
[:
1
])[
0
].
detach
()
x_sample
=
torch
.
clamp
((
x_sample
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
x_sample
=
255.
*
torch
.
clamp
((
x_sample
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
().
numpy
(),
0
,
2
)
x_sample
=
np
.
moveaxis
(
x_sample
.
to
(
device
=
"cpu"
,
dtype
=
torch
.
uint8
,
non_blocking
=
comfy
.
model_management
.
device_supports_non_blocking
(
x_sample
.
device
)).
numpy
(),
0
,
2
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
preview_image
=
Image
.
fromarray
(
x_sample
)
preview_image
=
Image
.
fromarray
(
x_sample
)
return
preview_image
return
preview_image
...
...
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