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
5e885bd9
Commit
5e885bd9
authored
Oct 10, 2023
by
comfyanonymous
Browse files
Cleanup.
parent
851bb87c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
comfy/taesd/taesd.py
comfy/taesd/taesd.py
+4
-10
No files found.
comfy/taesd/taesd.py
View file @
5e885bd9
...
...
@@ -6,6 +6,8 @@ Tiny AutoEncoder for Stable Diffusion
import
torch
import
torch.nn
as
nn
import
comfy.utils
def
conv
(
n_in
,
n_out
,
**
kwargs
):
return
nn
.
Conv2d
(
n_in
,
n_out
,
3
,
padding
=
1
,
**
kwargs
)
...
...
@@ -50,17 +52,9 @@ class TAESD(nn.Module):
self
.
encoder
=
Encoder
()
self
.
decoder
=
Decoder
()
if
encoder_path
is
not
None
:
if
encoder_path
.
lower
().
endswith
(
".safetensors"
):
import
safetensors.torch
self
.
encoder
.
load_state_dict
(
safetensors
.
torch
.
load_file
(
encoder_path
,
device
=
"cpu"
))
else
:
self
.
encoder
.
load_state_dict
(
torch
.
load
(
encoder_path
,
map_location
=
"cpu"
,
weights_only
=
True
))
self
.
encoder
.
load_state_dict
(
comfy
.
utils
.
load_torch_file
(
encoder_path
,
safe_load
=
True
))
if
decoder_path
is
not
None
:
if
decoder_path
.
lower
().
endswith
(
".safetensors"
):
import
safetensors.torch
self
.
decoder
.
load_state_dict
(
safetensors
.
torch
.
load_file
(
decoder_path
,
device
=
"cpu"
))
else
:
self
.
decoder
.
load_state_dict
(
torch
.
load
(
decoder_path
,
map_location
=
"cpu"
,
weights_only
=
True
))
self
.
decoder
.
load_state_dict
(
comfy
.
utils
.
load_torch_file
(
decoder_path
,
safe_load
=
True
))
@
staticmethod
def
scale_latents
(
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