fix text_encoder_lr to work with int closes #1608

This commit is contained in:
Kohya S
2024-09-17 21:21:28 +09:00
parent d8d15f1a7e
commit 0cbe95bcc7

View File

@@ -966,8 +966,8 @@ class LoRANetwork(torch.nn.Module):
# if float, use the same value for both text encoders # if float, use the same value for both text encoders
if text_encoder_lr is None or (isinstance(text_encoder_lr, list) and len(text_encoder_lr) == 0): if text_encoder_lr is None or (isinstance(text_encoder_lr, list) and len(text_encoder_lr) == 0):
text_encoder_lr = [default_lr, default_lr] text_encoder_lr = [default_lr, default_lr]
elif isinstance(text_encoder_lr, float): elif isinstance(text_encoder_lr, float) or isinstance(text_encoder_lr, int):
text_encoder_lr = [text_encoder_lr, text_encoder_lr] text_encoder_lr = [float(text_encoder_lr), float(text_encoder_lr)]
elif len(text_encoder_lr) == 1: elif len(text_encoder_lr) == 1:
text_encoder_lr = [text_encoder_lr[0], text_encoder_lr[0]] text_encoder_lr = [text_encoder_lr[0], text_encoder_lr[0]]