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
334aab05
"vscode:/vscode.git/clone" did not exist on "32fd39b4245a50757fd8257ea199f74ade348b9a"
Commit
334aab05
authored
Apr 14, 2023
by
comfyanonymous
Browse files
Don't stop workflow if loading embedding fails.
parent
61e7767c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
comfy/sd1_clip.py
comfy/sd1_clip.py
+15
-7
No files found.
comfy/sd1_clip.py
View file @
334aab05
...
...
@@ -2,6 +2,7 @@ import os
from
transformers
import
CLIPTokenizer
,
CLIPTextModel
,
CLIPTextConfig
import
torch
import
traceback
class
ClipTokenWeightEncoder
:
def
encode_token_weights
(
self
,
token_weight_pairs
):
...
...
@@ -194,14 +195,21 @@ def load_embed(embedding_name, embedding_directory):
embed_path
=
valid_file
if
embed_path
.
lower
().
endswith
(
".safetensors"
):
import
safetensors.torch
embed
=
safetensors
.
torch
.
load_file
(
embed_path
,
device
=
"cpu"
)
else
:
if
'weights_only'
in
torch
.
load
.
__code__
.
co_varnames
:
embed
=
torch
.
load
(
embed_path
,
weights_only
=
True
,
map_location
=
"cpu"
)
try
:
if
embed_path
.
lower
().
endswith
(
".safetensors"
):
import
safetensors.torch
embed
=
safetensors
.
torch
.
load_file
(
embed_path
,
device
=
"cpu"
)
else
:
embed
=
torch
.
load
(
embed_path
,
map_location
=
"cpu"
)
if
'weights_only'
in
torch
.
load
.
__code__
.
co_varnames
:
embed
=
torch
.
load
(
embed_path
,
weights_only
=
True
,
map_location
=
"cpu"
)
else
:
embed
=
torch
.
load
(
embed_path
,
map_location
=
"cpu"
)
except
Exception
as
e
:
print
(
traceback
.
format_exc
())
print
()
print
(
"error loading embedding, skipping loading:"
,
embedding_name
)
return
None
if
'string_to_param'
in
embed
:
values
=
embed
[
'string_to_param'
].
values
()
else
:
...
...
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