anyisalin commited on
Commit
4733315
·
1 Parent(s): 4ebd2b8

improve performance

Browse files
Files changed (1) hide show
  1. app.py +37 -2
app.py CHANGED
@@ -74,6 +74,41 @@ def create_ui():
74
  def train(novita_key, gender, base_model, training_name, max_train_steps, training_images):
75
  training_images = [_.name for _ in training_images]
76
  try:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  get_noviata_client(novita_key).create_training_subject(
78
  base_model=base_model,
79
  name=training_name,
@@ -81,7 +116,7 @@ def create_ui():
81
  class_prompt="person",
82
  max_train_steps=max_train_steps,
83
  images=training_images,
84
- components=FACE_TRAINING_DEFAULT_COMPONENTS,
85
  learning_rate=3e-4,
86
  seed=None,
87
  lr_scheduler='cosine_with_restarts',
@@ -111,7 +146,7 @@ def create_ui():
111
  lora_text_encoder_r=32,
112
  lora_text_encoder_alpha=32,
113
  ),
114
- components=[_.to_dict() for _ in FACE_TRAINING_DEFAULT_COMPONENTS],
115
  )
116
  except Exception as e:
117
  logging.error(e)
 
74
  def train(novita_key, gender, base_model, training_name, max_train_steps, training_images):
75
  training_images = [_.name for _ in training_images]
76
  try:
77
+ FACE_TRAINING_DEFAULT_COMPONENTS_NEW = [
78
+ TrainingComponent(
79
+ name="face_crop_region",
80
+ args=[{
81
+ "name": "ratio",
82
+ "value": "1.4"
83
+ }]
84
+ ),
85
+ TrainingComponent(
86
+ name="resize",
87
+ args=[
88
+ {
89
+ "name": "height",
90
+ "value": "512",
91
+ },
92
+ {
93
+ "name": "width",
94
+ "value": "512",
95
+ }
96
+ ]
97
+ ),
98
+ TrainingComponent(
99
+ name="face_restore",
100
+ args=[
101
+ {
102
+ "name": "method",
103
+ "value": "gfpgan_1.4"
104
+ },
105
+ {
106
+ "name": "upscale",
107
+ "value": "1.0"
108
+ }
109
+ ]
110
+ ),
111
+ ]
112
  get_noviata_client(novita_key).create_training_subject(
113
  base_model=base_model,
114
  name=training_name,
 
116
  class_prompt="person",
117
  max_train_steps=max_train_steps,
118
  images=training_images,
119
+ components=FACE_TRAINING_DEFAULT_COMPONENTS_NEW,
120
  learning_rate=3e-4,
121
  seed=None,
122
  lr_scheduler='cosine_with_restarts',
 
146
  lora_text_encoder_r=32,
147
  lora_text_encoder_alpha=32,
148
  ),
149
+ components=[_.to_dict() for _ in FACE_TRAINING_DEFAULT_COMPONENTS_NEW],
150
  )
151
  except Exception as e:
152
  logging.error(e)