File size: 8,645 Bytes
cad791c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "41c4f308-b68a-46b3-8ae7-1c7d46c981e4",
"metadata": {},
"outputs": [],
"source": [
"# ------------------------------------------------\n",
"# Hugging Face์์ ๋ค์ด๋ก๋ํ ๋ชจ๋ธ์ URL\n",
"model_urls = '''\n",
"https://huggingface.co/nuigurumi/basil_mix/resolve/main/Basil_mix_fixed.safetensors\n",
"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_hard.safetensors\n",
"'''\n",
"\n",
"vae_urls = '''\n",
"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors\n",
"'''\n",
"\n",
"lora_urls = '''\n",
"\n",
"'''\n",
"\n",
"embedding_urls = '''\n",
"\n",
"'''\n",
"\n",
"# Google Drive์์ ๋ค์ด๋ก๋ํ ๋ชจ๋ธ์ URL\n",
"g_model_urls = '''\n",
"https://drive.google.com/uc?id=1MTLIN8xkugpjQuY-gcoRSAnTBOITQLvr\n",
"'''\n",
"\n",
"g_model_names = '''\n",
"example(do_not_download).safetensors\n",
"'''\n",
"\n",
"g_vae_urls = '''\n",
"\n",
"'''\n",
"\n",
"g_vae_names = '''\n",
"\n",
"'''\n",
"\n",
"g_lora_urls = '''\n",
"\n",
"'''\n",
"\n",
"g_lora_names = '''\n",
"\n",
"'''\n",
"\n",
"g_embedding_urls = '''\n",
"\n",
"'''\n",
"\n",
"g_embedding_names = '''\n",
"\n",
"'''\n",
"\n",
"g_wildcard_urls = '''\n",
"\n",
"'''\n",
"\n",
"g_wildcard_names = '''\n",
"\n",
"'''\n",
"\n",
"g_config_urls = '''\n",
"\n",
"'''\n",
"\n",
"# ๊ธฐ๋ณธ ํ๋กฌํํธ\n",
"positive = 'best quality, ultra high res, (photorealistic:1.4), cinematic film, (depth of field:1.2), (portrait:1.3), (close to face:1.3), beautiful woman, (kpop idol:1.2), (short lower face:1.2), girlish face, (big eyes:0.8), (busty:1.7), (huge breasts), thick thighs, (walking), outdoor, crowded street'\n",
"negative = 'paintings, sketches, (film grain:1.6), (worst quality:2), (low quality:2), (normal quality:2), lowres, (wrinkles:1.8), ((monochrome)), ((grayscale)), (glossy skin), fat, skin spots, acnes, skin blemishes, age spot, glans, (saggy breasts:1.8)'\n",
"\n",
"# ์ค์นํ ํ์ฅ ๊ธฐ๋ฅ\n",
"extensions = '''\n",
"https://github.com/36DB/stable-diffusion-webui-localization-ko_KR\n",
"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding\n",
"https://github.com/dustysys/ddetailer\n",
"https://github.com/Mikubill/sd-webui-controlnet\n",
"https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards\n",
"https://github.com/fkunn1326/openpose-editor\n",
"https://github.com/jexom/sd-webui-depth-lib\n",
"https://github.com/opparco/stable-diffusion-webui-two-shot\n",
"'''\n",
"# ------------------------------------------------\n",
"\n",
"import os\n",
"import json\n",
"import shutil\n",
"\n",
"home_dir = os.getcwd()\n",
"repo_dir = os.path.join(home_dir, 'stable-diffusion-webui')\n",
"os.chdir(repo_dir)\n",
"\n",
"# ์๋ ์๋ sd ๋ชจ๋ธ ์ญ์ \n",
"for i in [x for x in os.listdir(home_dir) if x.endswith('.ckpt')]:\n",
" os.remove(os.path.join(home_dir, i))\n",
"\n",
"# Hugging Face์์ ๋ชจ๋ธ ๋ค์ด๋ก๋\n",
"models_dir = os.path.join(repo_dir, 'models', 'Stable-diffusion')\n",
"for i in [x.strip() for x in model_urls.split('\\n') if x]:\n",
" ! wget {i} -P {models_dir}\n",
"\n",
"# Hugging Face์์ vae ๋ค์ด๋ก๋\n",
"vae_dir = os.path.join(repo_dir, 'models', 'VAE')\n",
"for i in [x.strip() for x in vae_urls.split('\\n') if x]:\n",
" ! wget {i} -P {vae_dir}\n",
"\n",
"# Hugging Face์์ lora ๋ค์ด๋ก๋\n",
"lora_dir = os.path.join(repo_dir, 'models', 'Lora')\n",
"for i in [x.strip() for x in lora_urls.split('\\n') if x]:\n",
" ! wget {i} -P {lora_dir}\n",
"\n",
"# Hugging Face์์ embedding ๋ค์ด๋ก๋\n",
"embedding_dir = os.path.join(repo_dir, 'embeddings')\n",
"for i in [x.strip() for x in embedding_urls.split('\\n') if x]:\n",
" ! wget {i} -P {embedding_dir}\n",
"\n",
"# Goggle Drive์์ ๋ชจ๋ธ ๋ค์ด๋ก๋\n",
"g_model_dir = os.path.join(repo_dir, 'models', 'Stable-diffusion')\n",
"for i in [x.strip() for x in g_model_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"for i in [x.strip() for x in g_model_names.split('\\n') if x]:\n",
" ! mv {i} {g_model_dir}\n",
"\n",
"# Goggle Drive์์ vae ๋ค์ด๋ก๋\n",
"g_vae_dir = os.path.join(repo_dir, 'models', 'VAE')\n",
"for i in [x.strip() for x in g_vae_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"for i in [x.strip() for x in g_vae_names.split('\\n') if x]:\n",
" ! mv {i} {g_vae_dir}\n",
"\n",
"# Goggle Drive์์ lora ๋ค์ด๋ก๋\n",
"g_lora_dir = os.path.join(repo_dir, 'models', 'Lora')\n",
"for i in [x.strip() for x in g_lora_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"for i in [x.strip() for x in g_lora_names.split('\\n') if x]:\n",
" ! mv {i} {g_lora_dir}\n",
"\n",
"# Goggle Drive์์ embedding ๋ค์ด๋ก๋\n",
"g_embedding_dir = os.path.join(repo_dir, 'embeddings')\n",
"for i in [x.strip() for x in g_embedding_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"for i in [x.strip() for x in g_embedding_names.split('\\n') if x]:\n",
" ! mv {i} {g_embedding_dir}\n",
"\n",
"# ui-config.json ๋ฐฑ์
\n",
"ui_conf_path = os.path.join(repo_dir, 'ui-config.json')\n",
"ui_conf_bk_path = os.path.join(repo_dir, 'ui-config_bk.json')\n",
"if not os.path.exists(ui_conf_bk_path):\n",
" shutil.copy(ui_conf_path, ui_conf_bk_path)\n",
"with open(ui_conf_path, 'r', encoding='utf-8') as f:\n",
" orig_ui = json.load(f)\n",
" ur_ui = orig_ui\n",
"\n",
"# ui-config.json ์์ \n",
"ur_ui['txt2img/Prompt/value'] = positive\n",
"ur_ui['txt2img/Negative prompt/value'] = negative\n",
"\n",
"ur_ui['img2img/Prompt/value'] = positive\n",
"ur_ui['img2img/Negative prompt/value'] = negative\n",
"\n",
"# ํ์ผ ์ ์ฅ\n",
"with open(ui_conf_path, 'w', encoding='utf-8') as f:\n",
" json.dump(ur_ui, f, indent=4)\n",
"\n",
"# Goggle Drive์์ config ๋ค์ด๋ก๋\n",
"for i in [x.strip() for x in g_config_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"\n",
"# ํ์ํ ํ์ฅ ๋ชจ๋ ์ค์น\n",
"ext_dir = os.path.join(repo_dir, 'extensions')\n",
"os.chdir(ext_dir)\n",
"for i in [x.strip() for x in extensions.split('\\n') if x]:\n",
" ! git clone {i}\n",
"os.chdir(home_dir)\n",
"\n",
"# Goggle Drive์์ wildcard ๋ค์ด๋ก๋\n",
"g_wildcard_dir = os.path.join(repo_dir, 'extensions', 'stable-diffusion-webui-wildcards', 'wildcards')\n",
"for i in [x.strip() for x in g_wildcard_urls.split('\\n') if x]:\n",
" ! gdown {i}\n",
"for i in [x.strip() for x in g_wildcard_names.split('\\n') if x]:\n",
" ! mv {i} {g_wildcard_dir}\n",
"\n",
"!wget https://civitai.com/api/download/models/11739 -O controlnetPreTrained_openposeV10.safetensors\n",
"!wget https://civitai.com/api/download/models/11734 -O controlnetPreTrained_depthV10.safetensors\n",
"!wget https://civitai.com/api/download/models/11724 -O controlnetPreTrained_cannyV10.safetensors\n",
"!mv controlnetPreTrained_openposeV10.safetensors stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
"!mv controlnetPreTrained_depthV10.safetensors stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
"!mv controlnetPreTrained_cannyV10.safetensors stable-diffusion-webui/extensions/sd-webui-controlnet/models\n",
"!apt-get update -y\n",
"!apt install -y build-essential libgl1 python3-toolz libpython3.10-dev python3-distutils\n",
"!pip install --upgrade pip setuptools wheel"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"vscode": {
"interpreter": {
"hash": "c36c8ff63afb68809d72fa6323bde02fb9b90fe01b492d36c13befd021790766"
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|