Spaces:
Runtime error
Runtime error
File size: 7,400 Bytes
eac2d3c 5d9f2a5 eac2d3c 5d9f2a5 eac2d3c 5d9f2a5 eac2d3c 5d9f2a5 eac2d3c 5d9f2a5 eac2d3c |
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 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title - Instant (Simple)\n",
"import requests\n",
"import os\n",
"import subprocess\n",
"cek = subprocess.getoutput('nvidia-smi')\n",
"gpu_info = subprocess.getoutput('nvidia-smi')\n",
"if(\"A10G\" in gpu_info):\n",
" os.system(f\"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl\")\n",
"elif(\"T4\" in gpu_info):\n",
" os.system(f\"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+1515f77.d20221130-cp38-cp38-linux_x86_64.whl\")\n",
"\n",
"\n",
"#thanks to https://github.com/camenduru for the fork\n",
"print('\u001b[1;32mInstalling xformers...')\n",
"print('\u001b[0m')\n",
"#!if ! [ -f xformers ]; then pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl; pip install -q --pre triton; touch xformers; fi\n",
"if not os.path.isfile('xformers'):\n",
" print(\"Grabbing pre-built xformers from camenduru's repo\")\n",
" url = 'https://api.github.com/repos/camenduru/stable-diffusion-webui-colab/releases/latest'\n",
" response = requests.get(url)\n",
" print(\"Status code: \" + str(response.status_code))\n",
" if response.status_code == 200:\n",
" data = response.json()\n",
" templink = [link for link in [asset['browser_download_url'] for asset in data['assets'] if 'cp38' in asset['name']]]\n",
" xformerlink = templink[0]\n",
" else:\n",
" print(\"Request failed, loading last updated xformers instead\")\n",
" xformerlink = 'https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16%2B814314d.d20230118-cp38-cp38-linux_x86_64.whl'\n",
" !pip install -q $xformerlink\n",
" !pip install -q --pre triton\n",
" !touch xformers\n",
"print('\u001b[1;32mInstalling webui...')\n",
"print('\u001b[0m')\n",
"!if ! [ -d stable-diffusion-webui ]; then git clone -b v2.0 https://github.com/camenduru/stable-diffusion-webui; touch forkedwebui; fi\n",
"%cd stable-diffusion-webui\n",
"\n",
"#AnythingV3 Model & Vae\n",
"print('\u001b[1;32mDownloading AnythingV3 model...')\n",
"print('\u001b[0m')\n",
"%cd /home/user/app/stable-diffusion-webui/models/Stable-diffusion/\n",
"!if ! [ -f Anything-V3.0.safetensors ]; then wget -q https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-fp32-pruned.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors; fi\n",
"!if ! [ -f Anything-V3.0.vae.pt ]; then wget -q https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt; fi\n",
"\n",
"#webui setup for nai\n",
"print('\u001b[1;32mSetting UI configs...')\n",
"print('\u001b[0m')\n",
"%cd /home/user/app/stable-diffusion-webui\n",
"!if [ -f configinstan ]; then rm configinstan; fi\n",
"!if ! [ -f configinstanlite ]; then wget -q https://pastebin.com/raw/fmN0i5Sd -O /home/user/app/stable-diffusion-webui/ui-config.json && wget -q https://pastebin.com/raw/amVtB1NW -O /home/user/app/stable-diffusion-webui/config.json; fi\n",
"!if ! [ -f configinstanlite ]; then mv /home/user/app/stable-diffusion-webui/modules/ui.py /home/user/app/stable-diffusion-webui/modules/ui_backup.py && wget -q https://pastebin.com/raw/pKFWUfLM -O /home/user/app/stable-diffusion-webui/modules/ui.py; fi\n",
"!touch configinstanlite\n",
"\n",
"#notification bell\n",
"!wget -q https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /home/user/app/stable-diffusion-webui/notification.mp3\n",
"\n",
"#foolhardy remacri\n",
"! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && wget -q https://huggingface.co/etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /home/user/app/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth\n",
"\n",
"#extensions\n",
"print('\u001b[1;32mInstalling extensions...')\n",
"print('\u001b[0m')\n",
"%cd /home/user/app/stable-diffusion-webui/extensions\n",
"!bash -c 'for repo in AlUlkesh/stable-diffusion-webui-images-browser Extraltodeus/depthmap2mask DominikDoom/a1111-sd-webui-tagcomplete ddPn08/kohya-sd-scripts-webui arenatemp/stable-diffusion-webui-model-toolkit; do if [ ! -d \"$repo\" ]; then git clone \"https://github.com/$repo\" && true; fi; done'\n",
"!bash -c 'for repo in sd-civitai-browser kohya-sd-scripts-webui stable-diffusion-webui-model-toolkit batchlinks-webui; do if [ -d \"$repo\" ]; then rm -rf $repo && true; fi; done'\n",
"#%cd /home/user/app/stable-diffusion-webui/extensions/UnivAICharGen\n",
"#!git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 .\n",
"!git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI\n",
"\n",
"#badprompt & badartist\n",
"%cd /home/user/app/stable-diffusion-webui/embeddings/\n",
"!if ! [ -f bad_prompt.pt ]; then wget -q https://huggingface.co/datasets/Nerfgun3/bad_prompt/resolve/main/bad_prompt_version2.pt -O /home/user/app/stable-diffusion-webui/embeddings/bad_prompt.pt; fi\n",
"!if ! [ -f bad_artist.pt ]; then wget -q https://huggingface.co/NiXXerHATTER59/bad-artist/resolve/main/bad-artist.pt -O /home/user/app/stable-diffusion-webui/embeddings/bad_artist.pt; fi\n",
"!if ! [ -f bad_hands.pt ]; then wget -q https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /home/user/app/stable-diffusion-webui/embeddings/bad_hands.pt; fi\n",
"\n",
"#some fix\n",
"!sed -i -e '''/prepare_environment()/a\\ os.system\\(f\\\"\"\"sed -i -e ''\\\"s/dict()))/dict())).cuda()/g\\\"'' /home/user/app/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py\"\"\")''' /home/user/app/stable-diffusion-webui/launch.py\n",
"\n",
"print('\u001b[1;32mInstallation Success!')\n",
"print('\u001b[1;32mLaunching the webui...')\n",
"print('\u001b[0m')\n",
"%cd /home/user/app/stable-diffusion-webui\n",
"!python launch.py --ckpt /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors --vae-path /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt --share --xformers --enable-insecure-extension-access --gradio-queue"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "7b1f2b33e866b0bf2409397e5f58ba9cdf170d3b7f64c8f359c79998e2f88ad4"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|