Update Fooocus_onColabwithMM.ipynb
Browse files- Fooocus_onColabwithMM.ipynb +21 -26
Fooocus_onColabwithMM.ipynb
CHANGED
|
@@ -117,12 +117,25 @@
|
|
| 117 |
"\n",
|
| 118 |
"# 日本語パッチを追加\n",
|
| 119 |
"ja_json_url = \"https://raw.githubusercontent.com/aquapathos/FooocusJAni/refs/heads/main/ja.json\"\n",
|
| 120 |
-
"\n",
|
| 121 |
"ja_json_path = \"/content/Fooocus/language/ja.json\"\n",
|
| 122 |
"os.makedirs(os.path.dirname(ja_json_path), exist_ok=True)\n",
|
| 123 |
"!curl -L -o {ja_json_path} {ja_json_url}\n",
|
| 124 |
"print(f\"ja.json downloaded and saved to {ja_json_path}\")\n",
|
| 125 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
"setup_finished = True"
|
| 127 |
],
|
| 128 |
"metadata": {
|
|
@@ -161,33 +174,17 @@
|
|
| 161 |
"翻訳機能 = True # @param {type:\"boolean\"}\n",
|
| 162 |
"モデルタイプ = \"MM\" # @param [\"デフォルト\", \"アニメ\",\"MM\"] {allow-input: true}\n",
|
| 163 |
"\n",
|
| 164 |
-
"# MM用のプリセットを追加\n",
|
| 165 |
-
"mm_json_fname = \"mm_preset.json\" if GPU_ready else \"mm_cpu_preset.json\"\n",
|
| 166 |
-
"mm_json_url = f\"https://raw.githubusercontent.com/aquapathos/FooocusJAni/refs/heads/main/{mm_json_fname}\"\n",
|
| 167 |
-
"mm_json_path = \"/content/Fooocus/presets/mm_preset.json\"\n",
|
| 168 |
-
"os.makedirs(os.path.dirname(mm_json_path), exist_ok=True)\n",
|
| 169 |
-
"!curl -L -o {mm_json_path} {mm_json_url}\n",
|
| 170 |
-
"print(f\"mm_preset.json downloaded and saved to {mm_json_path}\")\n",
|
| 171 |
-
"\n",
|
| 172 |
-
"# アニメ版の設定ファイルのパッチ(最新版)を追加\n",
|
| 173 |
-
"anime_json_fname = \"anime.json\" if GPU_ready else \"anime_cpu.json\"\n",
|
| 174 |
-
"anime_json_url = f\"https://raw.githubusercontent.com/aquapathos/FooocusJAni/refs/heads/main/{anime_json_fname}\"\n",
|
| 175 |
-
"anime_json_path = \"/content/Fooocus/presets/anime.json\"\n",
|
| 176 |
-
"os.makedirs(os.path.dirname(anime_json_path), exist_ok=True)\n",
|
| 177 |
-
"!curl -L -o {anime_json_path} {anime_json_url}\n",
|
| 178 |
-
"print(f\"anime.json downloaded and saved to {anime_json_path}\")\n",
|
| 179 |
-
"\n",
|
| 180 |
"if 翻訳機能:\n",
|
|
|
|
| 181 |
" !git clone https://github.com/AlekPet/Fooocus_Extensions_AlekPet.git\n",
|
| 182 |
" !mv Fooocus_Extensions_AlekPet/prompt_translate/webui.py .\n",
|
| 183 |
" !mv Fooocus_Extensions_AlekPet/prompt_translate/modules/* ./modules\n",
|
| 184 |
" !sed -i.bak \"s/label='Enable translate', value=False/label='Enable translate', value=True/\" modules/module_translate.py\n",
|
| 185 |
" !sed -i.bak 's/\"default_prompt\": \"[^\"]*\"/\"default_prompt\": \"湖に映る逆さ絵の風景、人はいない、小さな田舎の家が建っている、家の前には赤いレトロな車、手前には色とりどりのコスモス畑\"/' presets/mm_preset.json\n",
|
| 186 |
" if not GPU_ready:\n",
|
| 187 |
-
" !sed -i.bak 's
|
|
|
|
| 188 |
" !sed -i.bak 's/1664\\*576/832\\*576/' modules/flags.py\n",
|
| 189 |
-
"else:\n",
|
| 190 |
-
" !sed -i.bak \"s/label='Enable translate', value=True/label='Enable translate', value=False/\" modules/module_translate.py\n",
|
| 191 |
"\n",
|
| 192 |
"if GPU_ready:\n",
|
| 193 |
" # GPUが使える場合\n",
|
|
@@ -205,22 +202,20 @@
|
|
| 205 |
" !python entry_with_update.py --preset mm_preset --always-high-vram --output-path {target_local_dir} --share --language ja\n",
|
| 206 |
"else:\n",
|
| 207 |
" # CPU Only\n",
|
| 208 |
-
" # GPUが使える場合\n",
|
| 209 |
" if モデルタイプ == \"デフォルト\" and not 日本語メニュー:\n",
|
| 210 |
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --output-path {target_local_dir} --share\n",
|
| 211 |
" elif モデルタイプ == \"デフォルト\" and 日本語メニュー :\n",
|
| 212 |
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --output-path {target_local_dir} --share --language ja\n",
|
| 213 |
" elif モデルタイプ == \"アニメ\" and not 日本語メニュー:\n",
|
| 214 |
-
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset
|
| 215 |
" elif モデルタイプ == \"アニメ\" and 日本語メニュー:\n",
|
| 216 |
-
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset
|
| 217 |
" elif モデルタイプ == \"MM\" and not 日本語メニュー:\n",
|
| 218 |
-
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset
|
| 219 |
" elif モデルタイプ == \"MM\" and 日本語メニュー:\n",
|
| 220 |
-
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset
|
| 221 |
],
|
| 222 |
"metadata": {
|
| 223 |
-
"cellView": "form",
|
| 224 |
"id": "4AUIG7Xsutxx"
|
| 225 |
},
|
| 226 |
"execution_count": null,
|
|
|
|
| 117 |
"\n",
|
| 118 |
"# 日本語パッチを追加\n",
|
| 119 |
"ja_json_url = \"https://raw.githubusercontent.com/aquapathos/FooocusJAni/refs/heads/main/ja.json\"\n",
|
|
|
|
| 120 |
"ja_json_path = \"/content/Fooocus/language/ja.json\"\n",
|
| 121 |
"os.makedirs(os.path.dirname(ja_json_path), exist_ok=True)\n",
|
| 122 |
"!curl -L -o {ja_json_path} {ja_json_url}\n",
|
| 123 |
"print(f\"ja.json downloaded and saved to {ja_json_path}\")\n",
|
| 124 |
"\n",
|
| 125 |
+
"# MM用のプリセットを追加\n",
|
| 126 |
+
"mm_json_url = \"https://huggingface.co/iciromaco/mm/raw/main/mm_preset.json\"\n",
|
| 127 |
+
"mm_json_path = \"/content/Fooocus/presets/mm_preset.json\" if GPU_ready else \"/content/Fooocus/presets/mm_cpu_preset.json\"\n",
|
| 128 |
+
"os.makedirs(os.path.dirname(mm_json_path), exist_ok=True)\n",
|
| 129 |
+
"!curl -L -o {mm_json_path} {mm_json_url}\n",
|
| 130 |
+
"print(f\"mm_preset.json downloaded and saved to {mm_json_path}\")\n",
|
| 131 |
+
"\n",
|
| 132 |
+
"# アニメ版の設定ファイルのパッチ(最新版)を追加\n",
|
| 133 |
+
"anime_json_url = \"https://raw.githubusercontent.com/aquapathos/FooocusJAni/refs/heads/main/anime.json\"\n",
|
| 134 |
+
"anime_json_path = \"/content/Fooocus/presets/anime.json\"\n",
|
| 135 |
+
"os.makedirs(os.path.dirname(anime_json_path), exist_ok=True)\n",
|
| 136 |
+
"!curl -L -o {anime_json_path} {anime_json_url}\n",
|
| 137 |
+
"print(f\"anime.json downloaded and saved to {anime_json_path}\")\n",
|
| 138 |
+
"\n",
|
| 139 |
"setup_finished = True"
|
| 140 |
],
|
| 141 |
"metadata": {
|
|
|
|
| 174 |
"翻訳機能 = True # @param {type:\"boolean\"}\n",
|
| 175 |
"モデルタイプ = \"MM\" # @param [\"デフォルト\", \"アニメ\",\"MM\"] {allow-input: true}\n",
|
| 176 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
"if 翻訳機能:\n",
|
| 178 |
+
" print(\"H\")\n",
|
| 179 |
" !git clone https://github.com/AlekPet/Fooocus_Extensions_AlekPet.git\n",
|
| 180 |
" !mv Fooocus_Extensions_AlekPet/prompt_translate/webui.py .\n",
|
| 181 |
" !mv Fooocus_Extensions_AlekPet/prompt_translate/modules/* ./modules\n",
|
| 182 |
" !sed -i.bak \"s/label='Enable translate', value=False/label='Enable translate', value=True/\" modules/module_translate.py\n",
|
| 183 |
" !sed -i.bak 's/\"default_prompt\": \"[^\"]*\"/\"default_prompt\": \"湖に映る逆さ絵の風景、人はいない、小さな田舎の家が建っている、家の前には赤いレトロな車、手前には色とりどりのコスモス畑\"/' presets/mm_preset.json\n",
|
| 184 |
" if not GPU_ready:\n",
|
| 185 |
+
" !sed -i.bak 's/\"default_prompt\": \"[^\"]*\"/\"default_prompt\": \"湖に映る逆さ絵の風景、人はいない、小さな田舎の家が建っている、家の前には赤いレトロな車、手前には色とりどりのコスモス畑\"/' presets/mm_cpu_preset.json\n",
|
| 186 |
+
" # !sed -i.bak 's/HYPER_SD = 4/HYPER_SD = 3/' modules/flags.py\n",
|
| 187 |
" !sed -i.bak 's/1664\\*576/832\\*576/' modules/flags.py\n",
|
|
|
|
|
|
|
| 188 |
"\n",
|
| 189 |
"if GPU_ready:\n",
|
| 190 |
" # GPUが使える場合\n",
|
|
|
|
| 202 |
" !python entry_with_update.py --preset mm_preset --always-high-vram --output-path {target_local_dir} --share --language ja\n",
|
| 203 |
"else:\n",
|
| 204 |
" # CPU Only\n",
|
|
|
|
| 205 |
" if モデルタイプ == \"デフォルト\" and not 日本語メニュー:\n",
|
| 206 |
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --output-path {target_local_dir} --share\n",
|
| 207 |
" elif モデルタイプ == \"デフォルト\" and 日本語メニュー :\n",
|
| 208 |
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --output-path {target_local_dir} --share --language ja\n",
|
| 209 |
" elif モデルタイプ == \"アニメ\" and not 日本語メニュー:\n",
|
| 210 |
+
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset anime_cpu --output-path {target_local_dir} --share\n",
|
| 211 |
" elif モデルタイプ == \"アニメ\" and 日本語メニュー:\n",
|
| 212 |
+
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset anime_cpu --output-path {target_local_dir} --share --language ja\n",
|
| 213 |
" elif モデルタイプ == \"MM\" and not 日本語メニュー:\n",
|
| 214 |
+
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset mm_cpu_preset --output-path {target_local_dir} --share\n",
|
| 215 |
" elif モデルタイプ == \"MM\" and 日本語メニュー:\n",
|
| 216 |
+
" !python entry_with_update.py --always-cpu 1 --vae-in-fp16 --unet-in-fp8-e5m2 --all-in-fp16 --attention-split --preset mm_cpu_preset --output-path {target_local_dir} --share --language ja\n"
|
| 217 |
],
|
| 218 |
"metadata": {
|
|
|
|
| 219 |
"id": "4AUIG7Xsutxx"
|
| 220 |
},
|
| 221 |
"execution_count": null,
|