fix input embed

This commit is contained in:
Koratahiu 2025-09-01 03:30:57 +03:00 committed by GitHub
parent c614b7e045
commit d95aac9063
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -259,7 +259,7 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder):
# Adjust output embedding indices based on where
# multi-token INPUT embeddings were inserted.
if emb is not None:
num_new_tokens = emb.shape[1]
num_new_tokens = emb.shape[0] if len(emb.shape) > 1 else 1
for i in range(len(output_embeds_for_prompt)):
if output_embeds_for_prompt[i][0] > o[0]:
output_embeds_for_prompt[i] = (output_embeds_for_prompt[i][0] + num_new_tokens - 1, output_embeds_for_prompt[i][1])