Commit
·
87b6ac9
1
Parent(s):
cc3fbaf
Update Scripts/mainpaperspacev2.py
Browse files- Scripts/mainpaperspacev2.py +13 -13
Scripts/mainpaperspacev2.py
CHANGED
@@ -523,7 +523,7 @@ def caption(CAPTIONS_DIR, INSTANCE_DIR):
|
|
523 |
|
524 |
|
525 |
|
526 |
-
def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encoder_Training_Steps, Text_Encoder_Concept_Training_Steps, Text_Encoder_Learning_Rate,
|
527 |
|
528 |
if os.path.exists(INSTANCE_DIR+"/.ipynb_checkpoints"):
|
529 |
call('rm -r '+INSTANCE_DIR+'/.ipynb_checkpoints', shell=True)
|
@@ -552,19 +552,16 @@ def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Enc
|
|
552 |
|
553 |
Seed=random.randint(1, 999999)
|
554 |
|
555 |
-
|
556 |
-
if
|
557 |
-
|
558 |
-
|
559 |
extrnlcptn=""
|
560 |
if External_Captions:
|
561 |
extrnlcptn="--external_captions"
|
562 |
|
563 |
precision="fp16"
|
564 |
-
|
565 |
-
GCUNET="--gradient_checkpointing"
|
566 |
-
if Resolution<=640:
|
567 |
-
GCUNET=""
|
568 |
|
569 |
resuming=""
|
570 |
if Resume_Training and os.path.exists(OUTPUT_DIR+'/unet/diffusion_pytorch_model.bin'):
|
@@ -614,18 +611,20 @@ def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Enc
|
|
614 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
615 |
'+trnonltxt+' \
|
616 |
'+extrnlcptn+' \
|
|
|
617 |
--train_text_encoder \
|
618 |
--image_captions_filename \
|
619 |
--dump_only_text_encoder \
|
620 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
621 |
--instance_data_dir='+INSTANCE_DIR+' \
|
622 |
--output_dir='+OUTPUT_DIR+' \
|
|
|
623 |
--instance_prompt='+PT+' \
|
624 |
--seed='+str(Seed)+' \
|
625 |
-
--resolution=
|
626 |
--mixed_precision='+str(precision)+' \
|
627 |
--train_batch_size=1 \
|
628 |
-
--gradient_accumulation_steps=1
|
629 |
--use_8bit_adam \
|
630 |
--learning_rate='+str(Text_Encoder_Learning_Rate)+' \
|
631 |
--lr_scheduler="linear" \
|
@@ -638,8 +637,8 @@ def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Enc
|
|
638 |
print('[1;32mResuming Training...[0m')
|
639 |
print('[1;33mTraining the UNet...[0m')
|
640 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
641 |
-
'+Style+' \
|
642 |
'+extrnlcptn+' \
|
|
|
643 |
--image_captions_filename \
|
644 |
--train_only_unet \
|
645 |
--Session_dir='+SESSION_DIR+' \
|
@@ -648,12 +647,13 @@ def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Enc
|
|
648 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
649 |
--instance_data_dir='+INSTANCE_DIR+' \
|
650 |
--output_dir='+OUTPUT_DIR+' \
|
|
|
651 |
--instance_prompt='+PT+' \
|
652 |
--seed='+str(Seed)+' \
|
653 |
--resolution='+str(Resolution)+' \
|
654 |
--mixed_precision='+str(precision)+' \
|
655 |
--train_batch_size=1 \
|
656 |
-
--gradient_accumulation_steps=1
|
657 |
--use_8bit_adam \
|
658 |
--learning_rate='+str(UNet_Learning_Rate)+' \
|
659 |
--lr_scheduler="linear" \
|
|
|
523 |
|
524 |
|
525 |
|
526 |
+
def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encoder_Training_Steps, Text_Encoder_Concept_Training_Steps, Text_Encoder_Learning_Rate, Offset_Noise, Resolution, MODEL_NAMEv2, SESSION_DIR, INSTANCE_DIR, CONCEPT_DIR, CAPTIONS_DIR, External_Captions, INSTANCE_NAME, Session_Name, OUTPUT_DIR, PT, resumev2, Save_Checkpoint_Every_n_Steps, Start_saving_from_the_step, Save_Checkpoint_Every):
|
527 |
|
528 |
if os.path.exists(INSTANCE_DIR+"/.ipynb_checkpoints"):
|
529 |
call('rm -r '+INSTANCE_DIR+'/.ipynb_checkpoints', shell=True)
|
|
|
552 |
|
553 |
Seed=random.randint(1, 999999)
|
554 |
|
555 |
+
ofstnse=""
|
556 |
+
if Offset_Noise:
|
557 |
+
ofstnse="--offset_noise"
|
558 |
+
|
559 |
extrnlcptn=""
|
560 |
if External_Captions:
|
561 |
extrnlcptn="--external_captions"
|
562 |
|
563 |
precision="fp16"
|
564 |
+
|
|
|
|
|
|
|
565 |
|
566 |
resuming=""
|
567 |
if Resume_Training and os.path.exists(OUTPUT_DIR+'/unet/diffusion_pytorch_model.bin'):
|
|
|
611 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
612 |
'+trnonltxt+' \
|
613 |
'+extrnlcptn+' \
|
614 |
+
'+ofstnse+' \
|
615 |
--train_text_encoder \
|
616 |
--image_captions_filename \
|
617 |
--dump_only_text_encoder \
|
618 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
619 |
--instance_data_dir='+INSTANCE_DIR+' \
|
620 |
--output_dir='+OUTPUT_DIR+' \
|
621 |
+
--captions_dir='+CAPTIONS_DIR+' \
|
622 |
--instance_prompt='+PT+' \
|
623 |
--seed='+str(Seed)+' \
|
624 |
+
--resolution='+str(Resolution)+' \
|
625 |
--mixed_precision='+str(precision)+' \
|
626 |
--train_batch_size=1 \
|
627 |
+
--gradient_accumulation_steps=1 \
|
628 |
--use_8bit_adam \
|
629 |
--learning_rate='+str(Text_Encoder_Learning_Rate)+' \
|
630 |
--lr_scheduler="linear" \
|
|
|
637 |
print('[1;32mResuming Training...[0m')
|
638 |
print('[1;33mTraining the UNet...[0m')
|
639 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
|
|
640 |
'+extrnlcptn+' \
|
641 |
+
'+ofstnse+' \
|
642 |
--image_captions_filename \
|
643 |
--train_only_unet \
|
644 |
--Session_dir='+SESSION_DIR+' \
|
|
|
647 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
648 |
--instance_data_dir='+INSTANCE_DIR+' \
|
649 |
--output_dir='+OUTPUT_DIR+' \
|
650 |
+
--captions_dir='+CAPTIONS_DIR+' \
|
651 |
--instance_prompt='+PT+' \
|
652 |
--seed='+str(Seed)+' \
|
653 |
--resolution='+str(Resolution)+' \
|
654 |
--mixed_precision='+str(precision)+' \
|
655 |
--train_batch_size=1 \
|
656 |
+
--gradient_accumulation_steps=1 \
|
657 |
--use_8bit_adam \
|
658 |
--learning_rate='+str(UNet_Learning_Rate)+' \
|
659 |
--lr_scheduler="linear" \
|