Skip to content

Commit

Permalink
Fix to work training U-Net only LoRA for SD1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
kohya-ss committed Oct 1, 2023
1 parent 6bd6cd9 commit 81419f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion train_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,10 @@ def train(self, args):
t_enc.train()

# set top parameter requires_grad = True for gradient checkpointing works
t_enc.text_model.embeddings.requires_grad_(True)
if train_text_encoder:
t_enc.text_model.embeddings.requires_grad_(True)
else:
unet.parameters().__next__().requires_grad_(True)
else:
unet.eval()
for t_enc in text_encoders:
Expand Down

0 comments on commit 81419f7

Please sign in to comment.