File tree 4 files changed +33
-54
lines changed
4 files changed +33
-54
lines changed Original file line number Diff line number Diff line change @@ -781,23 +781,23 @@ def train_model(
781
781
782
782
log .info (f"Regularization factor: { reg_factor } " )
783
783
784
- if max_train_steps == 0 :
785
- # calculate max_train_steps
786
- max_train_steps = int (
787
- math .ceil (
788
- float (total_steps )
789
- / int (train_batch_size )
790
- / int (gradient_accumulation_steps )
791
- * int (epoch )
792
- * int (reg_factor )
793
- )
794
- )
795
- max_train_steps_info = f"max_train_steps ({ total_steps } / { train_batch_size } / { gradient_accumulation_steps } * { epoch } * { reg_factor } ) = { max_train_steps } "
796
- else :
797
- if max_train_steps == 0 :
798
- max_train_steps_info = f"Max train steps: 0. sd-scripts will therefore default to 1600. Please specify a different value if required."
799
- else :
800
- max_train_steps_info = f"Max train steps: { max_train_steps } "
784
+ # if max_train_steps == 0:
785
+ # # calculate max_train_steps
786
+ # max_train_steps = int(
787
+ # math.ceil(
788
+ # float(total_steps)
789
+ # / int(train_batch_size)
790
+ # / int(gradient_accumulation_steps)
791
+ # * int(epoch)
792
+ # * int(reg_factor)
793
+ # )
794
+ # )
795
+ # max_train_steps_info = f"max_train_steps ({total_steps} / {train_batch_size} / {gradient_accumulation_steps} * {epoch} * {reg_factor}) = {max_train_steps}"
796
+ # else:
797
+ # if max_train_steps == 0:
798
+ # max_train_steps_info = f"Max train steps: 0. sd-scripts will therefore default to 1600. Please specify a different value if required."
799
+ # else:
800
+ # max_train_steps_info = f"Max train steps: {max_train_steps}"
801
801
802
802
log .info (f"Total steps: { total_steps } " )
803
803
Original file line number Diff line number Diff line change @@ -846,16 +846,16 @@ def train_model(
846
846
repeats = int (image_num ) * int (dataset_repeats )
847
847
log .info (f"repeats = { str (repeats )} " )
848
848
849
- if max_train_steps == 0 :
850
- # calculate max_train_steps
851
- max_train_steps = int (
852
- math .ceil (
853
- float (repeats )
854
- / int (train_batch_size )
855
- / int (gradient_accumulation_steps )
856
- * int (epoch )
857
- )
858
- )
849
+ # if max_train_steps == 0:
850
+ # # calculate max_train_steps
851
+ # max_train_steps = int(
852
+ # math.ceil(
853
+ # float(repeats)
854
+ # / int(train_batch_size)
855
+ # / int(gradient_accumulation_steps)
856
+ # * int(epoch)
857
+ # )
858
+ # )
859
859
860
860
# Divide by two because flip augmentation create two copied of the source images
861
861
if flip_aug and max_train_steps :
Original file line number Diff line number Diff line change @@ -1076,7 +1076,7 @@ def train_model(
1076
1076
1077
1077
log .info (f"Regularization factor: { reg_factor } " )
1078
1078
1079
- if max_train_steps == 0 :
1079
+ if ( max_train_steps == 0 ) and ( stop_text_encoder_training != 0 ) :
1080
1080
# calculate max_train_steps
1081
1081
max_train_steps = int (
1082
1082
math .ceil (
@@ -1094,13 +1094,9 @@ def train_model(
1094
1094
else :
1095
1095
max_train_steps_info = f"Max train steps: { max_train_steps } "
1096
1096
1097
- # calculate stop encoder training
1098
- if stop_text_encoder_training == 0 :
1099
- stop_text_encoder_training = 0
1100
- else :
1101
- stop_text_encoder_training = math .ceil (
1102
- float (max_train_steps ) / 100 * int (stop_text_encoder_training )
1103
- )
1097
+ stop_text_encoder_training = math .ceil (
1098
+ float (max_train_steps ) / 100 * int (stop_text_encoder_training )
1099
+ ) if stop_text_encoder_training != 0 else 0
1104
1100
1105
1101
# Calculate lr_warmup_steps
1106
1102
if lr_warmup_steps > 0 :
Original file line number Diff line number Diff line change @@ -664,22 +664,9 @@ def train_model(
664
664
log .info (f"Regularization factor: { reg_factor } " )
665
665
666
666
if max_train_steps == 0 :
667
- # calculate max_train_steps
668
- max_train_steps = int (
669
- math .ceil (
670
- float (total_steps )
671
- / int (train_batch_size )
672
- / int (gradient_accumulation_steps )
673
- * int (epoch )
674
- * int (reg_factor )
675
- )
676
- )
677
- max_train_steps_info = f"max_train_steps ({ total_steps } / { train_batch_size } / { gradient_accumulation_steps } * { epoch } * { reg_factor } ) = { max_train_steps } "
667
+ max_train_steps_info = f"Max train steps: 0. sd-scripts will therefore default to 1600. Please specify a different value if required."
678
668
else :
679
- if max_train_steps == 0 :
680
- max_train_steps_info = f"Max train steps: 0. sd-scripts will therefore default to 1600. Please specify a different value if required."
681
- else :
682
- max_train_steps_info = f"Max train steps: { max_train_steps } "
669
+ max_train_steps_info = f"Max train steps: { max_train_steps } "
683
670
684
671
# calculate stop encoder training
685
672
if stop_text_encoder_training_pct == 0 :
@@ -1076,10 +1063,6 @@ def list_embedding_files(path):
1076
1063
step = 1 ,
1077
1064
label = "Vectors" ,
1078
1065
)
1079
- # max_train_steps = gr.Textbox(
1080
- # label='Max train steps',
1081
- # placeholder='(Optional) Maximum number of steps',
1082
- # )
1083
1066
template = gr .Dropdown (
1084
1067
label = "Template" ,
1085
1068
choices = [
You can’t perform that action at this time.
0 commit comments