TheLastBen
commited on
Commit
·
cc3fbaf
1
Parent(s):
866e444
Update Scripts/mainpaperspacev1.py
Browse files- Scripts/mainpaperspacev1.py +13 -13
Scripts/mainpaperspacev1.py
CHANGED
@@ -508,7 +508,7 @@ def caption(CAPTIONS_DIR, INSTANCE_DIR):
|
|
508 |
|
509 |
|
510 |
|
511 |
-
def dbtrain(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encoder_Training_Steps, Text_Encoder_Concept_Training_Steps, Text_Encoder_Learning_Rate,
|
512 |
|
513 |
if os.path.exists(INSTANCE_DIR+"/.ipynb_checkpoints"):
|
514 |
call('rm -r '+INSTANCE_DIR+'/.ipynb_checkpoints', shell=True)
|
@@ -536,20 +536,17 @@ def dbtrain(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encod
|
|
536 |
MODELT_NAME=MODEL_NAME
|
537 |
|
538 |
Seed=random.randint(1, 999999)
|
539 |
-
|
540 |
-
|
541 |
-
if
|
542 |
-
|
543 |
-
|
544 |
extrnlcptn=""
|
545 |
if External_Captions:
|
546 |
extrnlcptn="--external_captions"
|
547 |
|
548 |
precision="fp16"
|
549 |
|
550 |
-
GCUNET="--gradient_checkpointing"
|
551 |
-
if Resolution<=640:
|
552 |
-
GCUNET=""
|
553 |
|
554 |
resuming=""
|
555 |
if Resume_Training and os.path.exists(OUTPUT_DIR+'/unet/diffusion_pytorch_model.bin'):
|
@@ -599,18 +596,20 @@ def dbtrain(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encod
|
|
599 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
600 |
'+trnonltxt+' \
|
601 |
'+extrnlcptn+' \
|
|
|
602 |
--train_text_encoder \
|
603 |
--image_captions_filename \
|
604 |
--dump_only_text_encoder \
|
605 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
606 |
--instance_data_dir='+INSTANCE_DIR+' \
|
607 |
--output_dir='+OUTPUT_DIR+' \
|
|
|
608 |
--instance_prompt='+PT+' \
|
609 |
--seed='+str(Seed)+' \
|
610 |
-
--resolution=
|
611 |
--mixed_precision='+str(precision)+' \
|
612 |
--train_batch_size=1 \
|
613 |
-
--gradient_accumulation_steps=1
|
614 |
--use_8bit_adam \
|
615 |
--learning_rate='+str(Text_Encoder_Learning_Rate)+' \
|
616 |
--lr_scheduler="linear" \
|
@@ -623,8 +622,8 @@ def dbtrain(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encod
|
|
623 |
print('[1;32mResuming Training...[0m')
|
624 |
print('[1;33mTraining the UNet...[0m')
|
625 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
626 |
-
'+Style+' \
|
627 |
'+extrnlcptn+' \
|
|
|
628 |
--image_captions_filename \
|
629 |
--train_only_unet \
|
630 |
--Session_dir='+SESSION_DIR+' \
|
@@ -633,12 +632,13 @@ def dbtrain(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Encod
|
|
633 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
634 |
--instance_data_dir='+INSTANCE_DIR+' \
|
635 |
--output_dir='+OUTPUT_DIR+' \
|
|
|
636 |
--instance_prompt='+PT+' \
|
637 |
--seed='+str(Seed)+' \
|
638 |
--resolution='+str(Resolution)+' \
|
639 |
--mixed_precision='+str(precision)+' \
|
640 |
--train_batch_size=1 \
|
641 |
-
--gradient_accumulation_steps=1
|
642 |
--use_8bit_adam \
|
643 |
--learning_rate='+str(UNet_Learning_Rate)+' \
|
644 |
--lr_scheduler="linear" \
|
|
|
508 |
|
509 |
|
510 |
|
511 |
+
def dbtrain(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_NAME, SESSION_DIR, INSTANCE_DIR, CONCEPT_DIR, CAPTIONS_DIR, External_Captions, INSTANCE_NAME, Session_Name, OUTPUT_DIR, PT, resume, Save_Checkpoint_Every_n_Steps, Start_saving_from_the_step, Save_Checkpoint_Every):
|
512 |
|
513 |
if os.path.exists(INSTANCE_DIR+"/.ipynb_checkpoints"):
|
514 |
call('rm -r '+INSTANCE_DIR+'/.ipynb_checkpoints', shell=True)
|
|
|
536 |
MODELT_NAME=MODEL_NAME
|
537 |
|
538 |
Seed=random.randint(1, 999999)
|
539 |
+
|
540 |
+
ofstnse=""
|
541 |
+
if Offset_Noise:
|
542 |
+
ofstnse="--offset_noise"
|
543 |
+
|
544 |
extrnlcptn=""
|
545 |
if External_Captions:
|
546 |
extrnlcptn="--external_captions"
|
547 |
|
548 |
precision="fp16"
|
549 |
|
|
|
|
|
|
|
550 |
|
551 |
resuming=""
|
552 |
if Resume_Training and os.path.exists(OUTPUT_DIR+'/unet/diffusion_pytorch_model.bin'):
|
|
|
596 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
597 |
'+trnonltxt+' \
|
598 |
'+extrnlcptn+' \
|
599 |
+
'+ofstnse+' \
|
600 |
--train_text_encoder \
|
601 |
--image_captions_filename \
|
602 |
--dump_only_text_encoder \
|
603 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
604 |
--instance_data_dir='+INSTANCE_DIR+' \
|
605 |
--output_dir='+OUTPUT_DIR+' \
|
606 |
+
--captions_dir='+CAPTIONS_DIR+' \
|
607 |
--instance_prompt='+PT+' \
|
608 |
--seed='+str(Seed)+' \
|
609 |
+
--resolution='+str(Resolution)+' \
|
610 |
--mixed_precision='+str(precision)+' \
|
611 |
--train_batch_size=1 \
|
612 |
+
--gradient_accumulation_steps=1 \
|
613 |
--use_8bit_adam \
|
614 |
--learning_rate='+str(Text_Encoder_Learning_Rate)+' \
|
615 |
--lr_scheduler="linear" \
|
|
|
622 |
print('[1;32mResuming Training...[0m')
|
623 |
print('[1;33mTraining the UNet...[0m')
|
624 |
call('accelerate launch /notebooks/diffusers/examples/dreambooth/train_dreambooth_pps.py \
|
|
|
625 |
'+extrnlcptn+' \
|
626 |
+
'+ofstnse+' \
|
627 |
--image_captions_filename \
|
628 |
--train_only_unet \
|
629 |
--Session_dir='+SESSION_DIR+' \
|
|
|
632 |
--pretrained_model_name_or_path='+MODELT_NAME+' \
|
633 |
--instance_data_dir='+INSTANCE_DIR+' \
|
634 |
--output_dir='+OUTPUT_DIR+' \
|
635 |
+
--captions_dir='+CAPTIONS_DIR+' \
|
636 |
--instance_prompt='+PT+' \
|
637 |
--seed='+str(Seed)+' \
|
638 |
--resolution='+str(Resolution)+' \
|
639 |
--mixed_precision='+str(precision)+' \
|
640 |
--train_batch_size=1 \
|
641 |
+
--gradient_accumulation_steps=1 \
|
642 |
--use_8bit_adam \
|
643 |
--learning_rate='+str(UNet_Learning_Rate)+' \
|
644 |
--lr_scheduler="linear" \
|