multimodalart HF staff commited on
Commit
b113e87
1 Parent(s): 0efd930

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -50,8 +50,11 @@ def swap_text(option, base):
50
  elif(option == "person"):
51
  instance_prompt_example = "julcto"
52
  freeze_for = 70
53
- show_prior_preservation = False
54
- prior_preservation_box_update = gr.update(visible=show_prior_preservation)
 
 
 
55
  return [f"You are going to train a `person`(s), upload 10-20 images of each person you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' target='_blank' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/person.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, prior_preservation_box_update]
56
  elif(option == "style"):
57
  instance_prompt_example = "trsldamrl"
@@ -85,6 +88,8 @@ def count_files(*inputs):
85
  Training_Steps = int(inputs[-3])
86
  else:
87
  Training_Steps = file_counter*150
 
 
88
  if(is_spaces):
89
  if(selected_model == "v1-5"):
90
  its = 1.1
@@ -181,9 +186,10 @@ def train(*inputs):
181
  Train_text_encoder_for=75
182
 
183
  Training_Steps = file_counter*150
184
-
 
185
  stptxt = int((Training_Steps*Train_text_encoder_for)/100)
186
- gradient_checkpointing = False if which_model == "v1-5" else True
187
  cache_latents = True if which_model != "v1-5" else False
188
  if (type_of_thing == "object" or type_of_thing == "style" or (type_of_thing == "person" and not experimental_face_improvement)):
189
  args_general = argparse.Namespace(
 
50
  elif(option == "person"):
51
  instance_prompt_example = "julcto"
52
  freeze_for = 70
53
+ show_prior_preservation = True if base != "v2-768" else False
54
+ if(show_prior_preservation):
55
+ prior_preservation_box_update = gr.update(visible=show_prior_preservation)
56
+ else:
57
+ prior_preservation_box_update = gr.update(visible=show_prior_preservation, value=False)
58
  return [f"You are going to train a `person`(s), upload 10-20 images of each person you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' target='_blank' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/person.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, prior_preservation_box_update]
59
  elif(option == "style"):
60
  instance_prompt_example = "trsldamrl"
 
88
  Training_Steps = int(inputs[-3])
89
  else:
90
  Training_Steps = file_counter*150
91
+ if(type_of_thing == "person" and Training_Steps > 2400):
92
+ Training_Steps = 2400 #Avoid overfitting on person faces
93
  if(is_spaces):
94
  if(selected_model == "v1-5"):
95
  its = 1.1
 
186
  Train_text_encoder_for=75
187
 
188
  Training_Steps = file_counter*150
189
+ if(type_of_thing == "person" and Training_Steps > 2600):
190
+ Training_Steps = 2600 #Avoid overfitting on people's faces
191
  stptxt = int((Training_Steps*Train_text_encoder_for)/100)
192
+ gradient_checkpointing = True
193
  cache_latents = True if which_model != "v1-5" else False
194
  if (type_of_thing == "object" or type_of_thing == "style" or (type_of_thing == "person" and not experimental_face_improvement)):
195
  args_general = argparse.Namespace(