Bluwynd commited on
Commit
901fc02
verified
1 Parent(s): ee5a293

Update autotrain.ipynb

Browse files
Files changed (1) hide show
  1. autotrain.ipynb +37 -29
autotrain.ipynb CHANGED
@@ -153,35 +153,43 @@
153
  "\n",
154
  "os.chdir(finetune_dir)\n",
155
  "\n",
156
- "config = {\n",
157
- " \"_train_data_dir\": train_data_dir,\n",
158
- " \"batch_size\": 8,\n",
159
- " \"repo_id\": \"SmilingWolf/wd-v1-4-convnextv2-tagger-v2\",\n",
160
- " \"recursive\": True,\n",
161
- " \"remove_underscore\": True,\n",
162
- " \"general_threshold\": Threshold,\n",
163
- " \"character_threshold\": 0.50,\n",
164
- " \"caption_extension\": \".txt\",\n",
165
- " \"max_data_loader_n_workers\": 2,\n",
166
- " \"debug\": True,\n",
167
- "}\n",
168
- "\n",
169
- "args = \"\"\n",
170
- "for k, v in config.items():\n",
171
- " if k.startswith(\"_\"):\n",
172
- " args += f'\"{v}\" '\n",
173
- " elif isinstance(v, str):\n",
174
- " args += f'--{k}=\"{v}\" '\n",
175
- " elif isinstance(v, bool) and v:\n",
176
- " args += f\"--{k} \"\n",
177
- " elif isinstance(v, float) and not isinstance(v, bool):\n",
178
- " args += f\"--{k}={v} \"\n",
179
- " elif isinstance(v, int) and not isinstance(v, bool):\n",
180
- " args += f\"--{k}={v} \"\n",
181
- "\n",
182
- "final_args = f\"python tag_images_by_wd14_tagger.py {args}\"\n",
183
- "if not NoAutoCaption :\n",
184
- " !{final_args}\n",
 
 
 
 
 
 
 
 
185
  "\n",
186
  "os.chdir(root_dir)\n",
187
  "\n",
 
153
  "\n",
154
  "os.chdir(finetune_dir)\n",
155
  "\n",
156
+ "config = {\n",
157
+ " \"_train_data_dir\": train_data_dir, # Manter a refer锚ncia original\n",
158
+ " \"batch_size\": 8, # Valor do segundo c贸digo\n",
159
+ " \"repo_id\": \"SmilingWolf/wd-v1-4-convnextv2-tagger-v2\", # Valor do segundo c贸digo\n",
160
+ " \"beam_search\": beam_search, # Manter a refer锚ncia original\n",
161
+ " \"min_length\": min_length, # Manter a refer锚ncia original\n",
162
+ " \"max_length\": max_length, # Manter a refer锚ncia original\n",
163
+ " \"debug\": True, # Do segundo c贸digo\n",
164
+ " \"caption_extension\": \".txt\", # Valor do segundo c贸digo\n",
165
+ " \"max_data_loader_n_workers\": 2, # Valor do segundo c贸digo\n",
166
+ " \"recursive\": True, # Do segundo c贸digo\n",
167
+ " \"remove_underscore\": True, # Do segundo c贸digo\n",
168
+ " \"general_threshold\": Threshold, # Do segundo c贸digo\n",
169
+ " \"character_threshold\": 0.50 # Do segundo c贸digo\n",
170
+ "}\n",
171
+ "\n",
172
+ "args = \"\"\n",
173
+ "for k, v in config.items():\n",
174
+ " if k.startswith(\"_\"):\n",
175
+ " args += f'\"{v}\" '\n",
176
+ " elif isinstance(v, str):\n",
177
+ " args += f'--{k}=\"{v}\" '\n",
178
+ " elif isinstance(v, bool) and v:\n",
179
+ " args += f\"--{k} \"\n",
180
+ " elif isinstance(v, float) and not isinstance(v, bool):\n",
181
+ " args += f\"--{k}={v} \"\n",
182
+ " elif isinstance(v, int) and not isinstance(v, bool):\n",
183
+ " args += f\"--{k}={v} \"\n",
184
+ "\n",
185
+ "# Verificar qual script executar com base em NoAutoCaption\n",
186
+ "if 'NoAutoCaption' not in locals() or not NoAutoCaption:\n",
187
+ " final_args = f\"python tag_images_by_wd14_tagger.py {args}\"\n",
188
+ "else:\n",
189
+ " final_args = f\"python make_captions.py {args}\"\n",
190
+ "\n",
191
+ "os.chdir(finetune_dir)\n",
192
+ "!{final_args}\n",
193
  "\n",
194
  "os.chdir(root_dir)\n",
195
  "\n",