fix iterator bug for #2295

This commit is contained in:
AUTOMATIC 2022-10-12 13:38:03 +03:00
parent 8561d5762b
commit 429442f4a6

View File

@ -323,10 +323,10 @@ class FrozenCLIPEmbedderWithCustomWords(torch.nn.Module):
tokens = [] tokens = []
multipliers = [] multipliers = []
for i in range(len(remade_batch_tokens)): for j in range(len(remade_batch_tokens)):
if len(remade_batch_tokens[i]) > 0: if len(remade_batch_tokens[j]) > 0:
tokens.append(remade_batch_tokens[i][:75]) tokens.append(remade_batch_tokens[j][:75])
multipliers.append(batch_multipliers[i][:75]) multipliers.append(batch_multipliers[j][:75])
else: else:
tokens.append([self.wrapped.tokenizer.eos_token_id] * 75) tokens.append([self.wrapped.tokenizer.eos_token_id] * 75)
multipliers.append([1.0] * 75) multipliers.append([1.0] * 75)