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
cd930d4e
Commit
cd930d4e
authored
Jun 18, 2023
by
comfyanonymous
Browse files
pop clip vision keys after loading them.
parent
c9e4a8c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
comfy/clip_vision.py
comfy/clip_vision.py
+8
-2
No files found.
comfy/clip_vision.py
View file @
cd930d4e
...
@@ -21,7 +21,7 @@ class ClipVisionModel():
...
@@ -21,7 +21,7 @@ class ClipVisionModel():
size
=
224
)
size
=
224
)
def
load_sd
(
self
,
sd
):
def
load_sd
(
self
,
sd
):
self
.
model
.
load_state_dict
(
sd
,
strict
=
False
)
return
self
.
model
.
load_state_dict
(
sd
,
strict
=
False
)
def
encode_image
(
self
,
image
):
def
encode_image
(
self
,
image
):
img
=
torch
.
clip
((
255.
*
image
[
0
]),
0
,
255
).
round
().
int
()
img
=
torch
.
clip
((
255.
*
image
[
0
]),
0
,
255
).
round
().
int
()
...
@@ -59,7 +59,13 @@ def load_clipvision_from_sd(sd):
...
@@ -59,7 +59,13 @@ def load_clipvision_from_sd(sd):
else
:
else
:
json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_vision_config_vitl.json"
)
json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_vision_config_vitl.json"
)
clip
=
ClipVisionModel
(
json_config
)
clip
=
ClipVisionModel
(
json_config
)
clip
.
load_sd
(
sd
)
m
,
u
=
clip
.
load_sd
(
sd
)
u
=
set
(
u
)
keys
=
list
(
sd
.
keys
())
for
k
in
keys
:
if
k
not
in
u
:
t
=
sd
.
pop
(
k
)
del
t
return
clip
return
clip
def
load
(
ckpt_path
):
def
load
(
ckpt_path
):
...
...
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