Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 29a1e54

Browse files
committed
Created using Colaboratory
1 parent 5938fc5 commit 29a1e54

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

kohya-trainer-resume.ipynb

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
" \"diffusers_fine_tuning_v2\", \\\n",
102102
" \"diffusers_fine_tuning_v3\", \\\n",
103103
" \"diffusers_fine_tuning_v4\"]\n",
104-
"version = \"diffusers_fine_tuning_v4\" #@param [\"diffusers_fine_tuning_v1\",\"diffusers_fine_tuning_v2\",\"diffusers_fine_tuning_v3\",\"diffusers_fine_tuning_v4\"]\n",
104+
"version = \"diffusers_fine_tuning_v3\" #@param [\"diffusers_fine_tuning_v1\",\"diffusers_fine_tuning_v2\",\"diffusers_fine_tuning_v3\",\"diffusers_fine_tuning_v4\"]\n",
105105
"\n",
106106
"customVersion.append((versionDir[versionList.index(version)]))\n",
107107
"\n",
@@ -311,12 +311,12 @@
311311
" \"Stable-Diffusion-v1-4\", \\\n",
312312
" \"Stable-Diffusion-v1-5-pruned-emaonly\" \\\n",
313313
" \"Waifu-Diffusion-v1-3-fp32\"]\n",
314-
"modelName = \"Anything-V3.0-pruned\" #@param [\"\", \"Animefull-final-pruned\", \"Animesfw-final-pruned\", \"Anything-V3.0-pruned-fp16\", \"Anything-V3.0-pruned-fp32\", \"Anything-V3.0-pruned\", \"Stable-Diffusion-v1-4\", \"Stable-Diffusion-v1-5-pruned-emaonly\", \"Waifu-Diffusion-v1-3-fp32\"]\n",
314+
"modelName = \"\" #@param [\"\", \"Animefull-final-pruned\", \"Animesfw-final-pruned\", \"Anything-V3.0-pruned-fp16\", \"Anything-V3.0-pruned-fp32\", \"Anything-V3.0-pruned\", \"Stable-Diffusion-v1-4\", \"Stable-Diffusion-v1-5-pruned-emaonly\", \"Waifu-Diffusion-v1-3-fp32\"]\n",
315315
"\n",
316316
"#@markdown ### Custom model\n",
317317
"#@markdown The model URL should be a direct download link.\n",
318-
"customName = \"\" #@param {'type': 'string'}\n",
319-
"customUrl = \"\"#@param {'type': 'string'}\n",
318+
"customName = \"herigaru5k\" #@param {'type': 'string'}\n",
319+
"customUrl = \"https://huggingface.co/Linaqruf/herigaru/resolve/main/herigaru5k.ckpt\"#@param {'type': 'string'}\n",
320320
"\n",
321321
"if customName == \"\" or customUrl == \"\":\n",
322322
" pass\n",
@@ -390,7 +390,7 @@
390390
"source": [
391391
"#@title Training begin\n",
392392
"num_cpu_threads_per_process = 8 #@param {'type':'integer'}\n",
393-
"pre_trained_model_path =\"/content/kohya-trainer/checkpoint/Anything-V3.0-pruned.ckpt\" #@param {'type':'string'}\n",
393+
"pre_trained_model_path =\"/content/herigaru/herigaru10k.ckpt\" #@param {'type':'string'}\n",
394394
"meta_lat_json_dir = \"/content/herigaru-tag/meta_lat.json\" #@param {'type':'string'}\n",
395395
"train_data_dir = \"/content/herigaru-tag/train_data\" #@param {'type':'string'}\n",
396396
"output_dir =\"/content/kohya-trainer/fine_tuned\" #@param {'type':'string'}\n",
@@ -415,6 +415,7 @@
415415
" --shuffle_caption \\\n",
416416
" --train_batch_size={train_batch_size} \\\n",
417417
" --learning_rate={learning_rate} \\\n",
418+
" --logging_dir=logs \\\n",
418419
" --max_token_length={max_token_length} \\\n",
419420
" --clip_skip={clip_skip} \\\n",
420421
" --mixed_precision={mixed_precision} \\\n",
@@ -423,9 +424,9 @@
423424
" --xformers \\\n",
424425
" --gradient_checkpointing \\\n",
425426
" --save_state \\\n",
426-
" --resume {resume_path} \\\n",
427-
" --gradient_accumulation_steps {gradient_accumulation_steps} \\\n",
428-
" --save_precision={save_precision} \n"
427+
" --gradient_accumulation_steps {gradient_accumulation_steps}\n",
428+
" # --save_precision={save_precision}\n",
429+
" # --resume {resume_path} \\\n"
429430
],
430431
"metadata": {
431432
"id": "X_Rd3Eh07xlA",
@@ -495,8 +496,8 @@
495496
"\n",
496497
"prune = True #@param {'type':'boolean'}\n",
497498
"\n",
498-
"model_src = \"/content/kohya-trainer/fine_tuned/last.ckpt\" #@param {'type' : 'string'}\n",
499-
"model_dst = \"/content/kohya-trainer/fine_tuned/last-pruned.ckpt\" #@param {'type' : 'string'}\n",
499+
"model_src = \"/content/kohya-trainer/checkpoint/herigaru5k.ckpt\" #@param {'type' : 'string'}\n",
500+
"model_dst = \"/content/kohya-trainer/checkpoint/herigaru5k.ckpt\" #@param {'type' : 'string'}\n",
500501
"\n",
501502
"if prune == True:\n",
502503
" import os\n",
@@ -506,7 +507,7 @@
506507
" !wget https://raw.githubusercontent.com/lopho/stable-diffusion-prune/main/prune.py\n",
507508
"\n",
508509
"\n",
509-
"!python3 prune.py -p {model_src} {model_dst}\n"
510+
"!python3 prune.py {model_src} {model_dst}\n"
510511
],
511512
"metadata": {
512513
"id": "LUOG7BzQVLKp",
@@ -532,6 +533,21 @@
532533
"execution_count": null,
533534
"outputs": []
534535
},
536+
{
537+
"cell_type": "code",
538+
"source": [
539+
"#@title Visualize loss graph (Optional)\n",
540+
"%cd /content/kohya-trainer\n",
541+
"%load_ext tensorboard\n",
542+
"%tensorboard --logdir logs"
543+
],
544+
"metadata": {
545+
"cellView": "form",
546+
"id": "PeWyOG73DR4T"
547+
},
548+
"execution_count": null,
549+
"outputs": []
550+
},
535551
{
536552
"cell_type": "markdown",
537553
"source": [

0 commit comments

Comments
 (0)