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
9e37f4c7
Commit
9e37f4c7
authored
Jun 23, 2023
by
comfyanonymous
Browse files
Fix error with ClipVision loader node.
parent
3e0686ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
comfy/clip_vision.py
comfy/clip_vision.py
+3
-2
comfy/sd.py
comfy/sd.py
+1
-1
No files found.
comfy/clip_vision.py
View file @
9e37f4c7
...
@@ -52,8 +52,9 @@ def convert_to_transformers(sd, prefix):
...
@@ -52,8 +52,9 @@ def convert_to_transformers(sd, prefix):
sd
=
transformers_convert
(
sd
,
prefix
,
"vision_model."
,
32
)
sd
=
transformers_convert
(
sd
,
prefix
,
"vision_model."
,
32
)
return
sd
return
sd
def
load_clipvision_from_sd
(
sd
,
prefix
):
def
load_clipvision_from_sd
(
sd
,
prefix
=
""
,
convert_keys
=
False
):
sd
=
convert_to_transformers
(
sd
,
prefix
)
if
convert_keys
:
sd
=
convert_to_transformers
(
sd
,
prefix
)
if
"vision_model.encoder.layers.30.layer_norm1.weight"
in
sd
:
if
"vision_model.encoder.layers.30.layer_norm1.weight"
in
sd
:
json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_vision_config_h.json"
)
json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_vision_config_h.json"
)
else
:
else
:
...
...
comfy/sd.py
View file @
9e37f4c7
...
@@ -1049,7 +1049,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
...
@@ -1049,7 +1049,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
if
model_config
.
clip_vision_prefix
is
not
None
:
if
model_config
.
clip_vision_prefix
is
not
None
:
if
output_clipvision
:
if
output_clipvision
:
clipvision
=
clip_vision
.
load_clipvision_from_sd
(
sd
,
model_config
.
clip_vision_prefix
)
clipvision
=
clip_vision
.
load_clipvision_from_sd
(
sd
,
model_config
.
clip_vision_prefix
,
True
)
model
=
model_config
.
get_model
(
sd
)
model
=
model_config
.
get_model
(
sd
)
model
.
load_model_weights
(
sd
,
"model.diffusion_model."
)
model
.
load_model_weights
(
sd
,
"model.diffusion_model."
)
...
...
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