1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

fixed SDXL text encoder training bug #5016 (#5078)

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
Shyam Marjit
2023-10-23 23:13:43 +05:30
committed by GitHub
parent 16851efa0f
commit 677df5ac12

View File

@@ -1070,6 +1070,11 @@ def main(args):
if args.train_text_encoder:
text_encoder_one.train()
text_encoder_two.train()
# set top parameter requires_grad = True for gradient checkpointing works
text_encoder_one.text_model.embeddings.requires_grad_(True)
text_encoder_two.text_model.embeddings.requires_grad_(True)
for step, batch in enumerate(train_dataloader):
with accelerator.accumulate(unet):
pixel_values = batch["pixel_values"].to(dtype=vae.dtype)