"deploy/vscode:/vscode.git/clone" did not exist on "1417a3c2cfb849e97e21171667f2d0f5e1f5d76c"
Commit 1718730e authored by comfyanonymous's avatar comfyanonymous
Browse files

Ignore embeddings when sizes don't match and print a WARNING.

parent 5036fecb
...@@ -74,9 +74,12 @@ class SD1ClipModel(torch.nn.Module, ClipTokenWeightEncoder): ...@@ -74,9 +74,12 @@ class SD1ClipModel(torch.nn.Module, ClipTokenWeightEncoder):
if isinstance(y, int): if isinstance(y, int):
tokens_temp += [y] tokens_temp += [y]
else: else:
if y.shape[0] == current_embeds.weight.shape[1]:
embedding_weights += [y] embedding_weights += [y]
tokens_temp += [next_new_token] tokens_temp += [next_new_token]
next_new_token += 1 next_new_token += 1
else:
print("WARNING: shape mismatch when trying to apply embedding, embedding will be ignored", y.shape[0], current_embeds.weight.shape[1])
out_tokens += [tokens_temp] out_tokens += [tokens_temp]
if len(embedding_weights) > 0: if len(embedding_weights) > 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment