{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "41c4f308-b68a-46b3-8ae7-1c7d46c981e4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2023-02-06 09:16:04-- https://huggingface.co/syaimu/7th_Layer/resolve/main/7th_anime_v3/7th_anime_v3_A.safetensors\n", "Resolving huggingface.co (huggingface.co)... 3.231.67.228, 54.235.118.239, 2600:1f18:147f:e800:671:b733:ecf3:a585, ...\n", "Connecting to huggingface.co (huggingface.co)|3.231.67.228|:443... connected.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://cdn-lfs.huggingface.co/repos/0c/8c/0c8c3a139a854a317f227f1f1c2f695f4e7f15fa728359e39f1b6085d4c23d36/c330a60ddcb49c61109dbd7c28cf326733dadb77984c6e8d162bdc200a05df9e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%277th_anime_v3_A.safetensors%3B+filename%3D%227th_anime_v3_A.safetensors%22%3B&Expires=1675933915&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzBjLzhjLzBjOGMzYTEzOWE4NTRhMzE3ZjIyN2YxZjFjMmY2OTVmNGU3ZjE1ZmE3MjgzNTllMzlmMWI2MDg1ZDRjMjNkMzYvYzMzMGE2MGRkY2I0OWM2MTEwOWRiZDdjMjhjZjMyNjczM2RhZGI3Nzk4NGM2ZThkMTYyYmRjMjAwYTA1ZGY5ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NzU5MzM5MTV9fX1dfQ__&Signature=WLQ4Kifv-3QwBHonSdrZOx7Ef0Z0iyV6danwso-DE2jaEj7JckLyYtMjhTLbjAHhULHsx-MZTrqnWFweXxg2%7E0Qg0zKwcA-UNYGcsPisO8jr2CHLkWvEhcB53cBZhSYktnzOKHt75M837DG6-IyDePIYjlSLcYRTQRRPWM3WrQB2GkRGUVdo6tfOW4wOBld%7ELB2FE--NIABzhm0WJoCQ-%7E23QYayFAn%7ELB5yZJvbBTcKiJmljZg8BRhwVrEsIWjVdRrna4yl3TXe6Dv-qCjJvtu%7Eit9BehWAjmhCCN1jsiowo51UcOeElvGuVz9gs-c4XAOv8ZH2GBYzPkNHvsBFAg__&Key-Pair-Id=KVTP0A1DKRTAX [following]\n", "--2023-02-06 09:16:05-- https://cdn-lfs.huggingface.co/repos/0c/8c/0c8c3a139a854a317f227f1f1c2f695f4e7f15fa728359e39f1b6085d4c23d36/c330a60ddcb49c61109dbd7c28cf326733dadb77984c6e8d162bdc200a05df9e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%277th_anime_v3_A.safetensors%3B+filename%3D%227th_anime_v3_A.safetensors%22%3B&Expires=1675933915&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzBjLzhjLzBjOGMzYTEzOWE4NTRhMzE3ZjIyN2YxZjFjMmY2OTVmNGU3ZjE1ZmE3MjgzNTllMzlmMWI2MDg1ZDRjMjNkMzYvYzMzMGE2MGRkY2I0OWM2MTEwOWRiZDdjMjhjZjMyNjczM2RhZGI3Nzk4NGM2ZThkMTYyYmRjMjAwYTA1ZGY5ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NzU5MzM5MTV9fX1dfQ__&Signature=WLQ4Kifv-3QwBHonSdrZOx7Ef0Z0iyV6danwso-DE2jaEj7JckLyYtMjhTLbjAHhULHsx-MZTrqnWFweXxg2%7E0Qg0zKwcA-UNYGcsPisO8jr2CHLkWvEhcB53cBZhSYktnzOKHt75M837DG6-IyDePIYjlSLcYRTQRRPWM3WrQB2GkRGUVdo6tfOW4wOBld%7ELB2FE--NIABzhm0WJoCQ-%7E23QYayFAn%7ELB5yZJvbBTcKiJmljZg8BRhwVrEsIWjVdRrna4yl3TXe6Dv-qCjJvtu%7Eit9BehWAjmhCCN1jsiowo51UcOeElvGuVz9gs-c4XAOv8ZH2GBYzPkNHvsBFAg__&Key-Pair-Id=KVTP0A1DKRTAX\n", "Resolving cdn-lfs.huggingface.co (cdn-lfs.huggingface.co)... 99.86.63.67, 99.86.63.91, 99.86.63.37, ...\n", "Connecting to cdn-lfs.huggingface.co (cdn-lfs.huggingface.co)|99.86.63.67|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 4265096689 (4.0G) [binary/octet-stream]\n", "Saving to: ‘/workspace/stable-diffusion-webui/models/Stable-diffusion/7th_anime_v3_A.safetensors’\n", "\n", "7th_anime_v3_A.safe 100%[===================>] 3.97G 189MB/s in 23s \n", "\n", "2023-02-06 09:16:28 (174 MB/s) - ‘/workspace/stable-diffusion-webui/models/Stable-diffusion/7th_anime_v3_A.safetensors’ saved [4265096689/4265096689]\n", "\n" ] } ], "source": [ "# ------------------------------------------------\n", "# 다운로드할 모델의 URL\n", "model_urls = '''\n", "https://huggingface.co/BanKaiPls/AsianModel/resolve/main/BRAV5finalfp16.safetensors\n", "https://huggingface.co/syaimu/7th_Layer/resolve/main/7th_anime_v3/7th_anime_v3_A.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/zemihr_v2.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", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/aliceNikke_v30.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/cuteGirlMix4_v10.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/epiNoiseoffset_v2.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/fashionGirl_v52.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/girlfriendmixV1_v20.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/gymtastic_v11.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/shojovibe_v11.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/spiderwoman_cosplay_outfit.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/volleyballUniform_v20Lora.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/hipoly3DModelLora_v20.safetensors\n", "'''\n", "\n", "embeding_urls = '''\n", "https://huggingface.co/nancho2/nancho_runpods/resolve/main/NG_DeepNegative_V1_75T.pt\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/bad_prompt_version2.pt\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/badhandv4.pt\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/easynegative.safetensors\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/pureerosface_v1.pt\n", "https://huggingface.co/eseutiblog/RunPod_database/resolve/main/ulzzang-6500-v1.1.bin\n", "'''\n", "\n", "controlnet_urls = '''\n", "'''\n", "\n", "# 기본 프롬프트\n", "positive = 'masterpiece, best quality, highres, 1girl, '\n", "negative = '(worst quality:1.9), (low quality:1.9), (normal quality:1.9), lowres, (infant, loli:1.5), '\n", "\n", "# 설치할 확장 기능\n", "extensions = '''\n", "https://github.com/nonnonstop/sd-webui-3d-open-pose-editor\n", "https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper.git\n", "https://github.com/Mikubill/sd-webui-controlnet\n", "https://github.com/hnmr293/sd-webui-cutoff\n", "https://github.com/DominikDoom/a1111-sd-webui-tagcomplete\n", "https://github.com/adieyal/sd-dynamic-prompts.git\n", "https://github.com/mcmonkeyprojects/sd-dynamic-thresholding\n", "https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111\n", "https://github.com/vladmandic/sd-extension-system-info\n", "https://github.com/richrobber2/canvas-zoom\n", "https://github.com/kousw/stable-diffusion-webui-daam\n", "https://github.com/kohya-ss/sd-webui-additional-networks\n", "https://github.com/Bing-su/adetailer\n", "https://github.com/NeoGraph-K/sd-webui-ddsd\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", "# 모델 다운로드\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", "# 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", "# 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", "# embeding 다운로드\n", "embeding_dir = os.path.join(repo_dir, 'embeddings')\n", "for i in [x.strip() for x in embeding_urls.split('\\n') if x]:\n", " ! wget {i} -P {embeding_dir}\n", "\n", "# controlnet 다운로드\n", "controlnet_dir = os.path.join(repo_dir, 'extensions', 'sd-webui-controlnet', 'models')\n", "for i in [x.strip() for x in controlnet_urls.split('\\n') if x]:\n", " ! wget {i} -P {controlnet_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", "# 필요한 확장 모듈 설치\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", "!pip install --upgrade ultralytics\n", "\n", "!pip3 install -U --pre dynamicprompts\n", "\n", "!pip install --upgrade segment_anything\n", "!pip install --upgrade mediapipe\n", "!pip install --upgrade pillow_lut\n", "\n", "!pip install git+https://github.com/facebookresearch/segment-anything.git\n", "!git clone https://github.com/IDEA-Research/GroundingDINO %cd /content/GroundingDINO !pip install -e .\n", "! pip install diffusers transformers accelerate scipy safetensors\n", "!pip install -e GroundingDINO\n", "!pip install --upgrade groundingdino\n", "!git clone https://github.com/IDEA-Research/GroundingDINO.git\n", "%cd GroundingDINO\n", "!pip install -e .\n", "%cd\n", "\n", "import os\n", "os.system(\"rm -rf lampp venv\")" ] } ], "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.10" }, "vscode": { "interpreter": { "hash": "c36c8ff63afb68809d72fa6323bde02fb9b90fe01b492d36c13befd021790766" } } }, "nbformat": 4, "nbformat_minor": 5 }