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
be3468dd
Commit
be3468dd
authored
Dec 04, 2023
by
comfyanonymous
Browse files
Less useless downcasting.
parent
ca82ade7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
comfy/sd1_clip.py
comfy/sd1_clip.py
+7
-3
No files found.
comfy/sd1_clip.py
View file @
be3468dd
...
@@ -84,12 +84,16 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder):
...
@@ -84,12 +84,16 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder):
self
.
inner_name
=
inner_name
self
.
inner_name
=
inner_name
if
dtype
is
not
None
:
if
dtype
is
not
None
:
self
.
transformer
.
to
(
dtype
)
inner_model
=
getattr
(
self
.
transformer
,
self
.
inner_name
)
inner_model
=
getattr
(
self
.
transformer
,
self
.
inner_name
)
if
hasattr
(
inner_model
,
"embeddings"
):
if
hasattr
(
inner_model
,
"embeddings"
):
inner_model
.
embeddings
.
to
(
torch
.
float32
)
embeddings_bak
=
inner_model
.
embeddings
.
to
(
torch
.
float32
)
inner_model
.
embeddings
=
None
self
.
transformer
.
to
(
dtype
)
inner_model
.
embeddings
=
embeddings_bak
else
:
else
:
self
.
transformer
.
set_input_embeddings
(
self
.
transformer
.
get_input_embeddings
().
to
(
torch
.
float32
))
previous_inputs
=
self
.
transformer
.
get_input_embeddings
().
to
(
torch
.
float32
,
copy
=
True
)
self
.
transformer
.
to
(
dtype
)
self
.
transformer
.
set_input_embeddings
(
previous_inputs
)
self
.
max_length
=
max_length
self
.
max_length
=
max_length
if
freeze
:
if
freeze
:
...
...
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