Datasets:
Languages:
Portuguese
Update autotrain.ipynb
Browse files- autotrain.ipynb +29 -37
autotrain.ipynb
CHANGED
@@ -153,43 +153,35 @@
|
|
153 |
"\n",
|
154 |
"os.chdir(finetune_dir)\n",
|
155 |
"\n",
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
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",
|
|
|
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\": 0.50,\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",
|