Unverified Commit ac07b6dc authored by jnhuang's avatar jnhuang Committed by GitHub
Browse files

Fix Wrong Text-encoder Grad Setting in Custom_Diffusion Training (#7302)



fix index in set textencoder grad
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
parent 46ab56a4
......@@ -1178,7 +1178,7 @@ def main(args):
grads_text_encoder = text_encoder.get_input_embeddings().weight.grad
# Get the index for tokens that we want to zero the grads for
index_grads_to_zero = torch.arange(len(tokenizer)) != modifier_token_id[0]
for i in range(len(modifier_token_id[1:])):
for i in range(1, len(modifier_token_id)):
index_grads_to_zero = index_grads_to_zero & (
torch.arange(len(tokenizer)) != modifier_token_id[i]
)
......
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