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
b7933960
Commit
b7933960
authored
Jun 24, 2023
by
comfyanonymous
Browse files
Fix CLIPLoader node.
parent
78d8035f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
comfy/sd.py
comfy/sd.py
+11
-4
No files found.
comfy/sd.py
View file @
b7933960
...
...
@@ -961,12 +961,19 @@ def load_style_model(ckpt_path):
def
load_clip
(
ckpt_path
,
embedding_directory
=
None
):
clip_data
=
utils
.
load_torch_file
(
ckpt_path
,
safe_load
=
True
)
config
=
{}
class
EmptyClass
:
pass
clip_target
=
EmptyClass
()
clip_target
.
params
=
{}
if
"text_model.encoder.layers.22.mlp.fc1.weight"
in
clip_data
:
config
[
'target'
]
=
'comfy.ldm.modules.encoders.modules.FrozenOpenCLIPEmbedder'
clip_target
.
clip
=
sd2_clip
.
SD2ClipModel
clip_target
.
tokenizer
=
sd2_clip
.
SD2Tokenizer
else
:
config
[
'target'
]
=
'comfy.ldm.modules.encoders.modules.FrozenCLIPEmbedder'
clip
=
CLIP
(
config
=
config
,
embedding_directory
=
embedding_directory
)
clip_target
.
clip
=
sd1_clip
.
SD1ClipModel
clip_target
.
tokenizer
=
sd1_clip
.
SD1Tokenizer
clip
=
CLIP
(
clip_target
,
embedding_directory
=
embedding_directory
)
clip
.
load_from_state_dict
(
clip_data
)
return
clip
...
...
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