Spaces:
Running
on
A10G
Running
on
A10G
Commit
•
557a2dd
1
Parent(s):
6bff7c7
Update app.py
Browse files
app.py
CHANGED
@@ -27,8 +27,12 @@ def load_learned_embed_in_clip(learned_embeds_path, text_encoder, tokenizer, tok
|
|
27 |
|
28 |
# cast to dtype of text_encoder
|
29 |
dtype = text_encoder.get_input_embeddings().weight.dtype
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
# add the token in tokenizer
|
33 |
token = token if token is not None else trained_token
|
34 |
num_added_tokens = tokenizer.add_tokens(token)
|
|
|
27 |
|
28 |
# cast to dtype of text_encoder
|
29 |
dtype = text_encoder.get_input_embeddings().weight.dtype
|
30 |
+
#If embed invalid, skip
|
31 |
+
try:
|
32 |
+
embeds.to(dtype)
|
33 |
+
except:
|
34 |
+
continue
|
35 |
+
|
36 |
# add the token in tokenizer
|
37 |
token = token if token is not None else trained_token
|
38 |
num_added_tokens = tokenizer.add_tokens(token)
|