Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 8dbd2ff

Browse files
committed
Remove duplicate lora save
1 parent 053b517 commit 8dbd2ff

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

train.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -525,42 +525,6 @@ def replace_prompt(prompt, token, wlist):
525525
if w in prompt: return prompt.replace(w, token)
526526
return prompt
527527

528-
def handle_lora_save(
529-
use_unet_lora,
530-
use_text_lora,
531-
model,
532-
save_path,
533-
checkpoint_step,
534-
unet_target_replace_module=None,
535-
text_target_replace_module=None,
536-
end_train=False
537-
):
538-
if end_train:
539-
if use_unet_lora:
540-
collapse_lora(model.unet)
541-
monkeypatch_remove_lora(model.unet)
542-
543-
if use_text_lora:
544-
collapse_lora(model.text_encoder)
545-
monkeypatch_remove_lora(model.text_encoder)
546-
547-
if not end_train:
548-
save_path = f"{save_path}/lora"
549-
os.makedirs(save_path, exist_ok=True)
550-
551-
if use_unet_lora and unet_target_replace_module is not None:
552-
save_lora_weight(
553-
model.unet,
554-
f"{save_path}/{checkpoint_step}_unet.pt",
555-
unet_target_replace_module
556-
)
557-
if use_text_lora and text_target_replace_module is not None:
558-
save_lora_weight(
559-
model.text_encoder,
560-
f"{save_path}/{checkpoint_step}_text_encoder.pt",
561-
text_target_replace_module
562-
)
563-
564528
def main(
565529
pretrained_model_path: str,
566530
output_dir: str,

0 commit comments

Comments
 (0)