Upload installau1111.ipynb
Browse files- installau1111.ipynb +107 -0
installau1111.ipynb
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"from IPython.utils import capture\n",
|
| 10 |
+
"from IPython.display import clear_output\n",
|
| 11 |
+
"from subprocess import getoutput\n",
|
| 12 |
+
"import ipywidgets as widgets\n",
|
| 13 |
+
"import sys\n",
|
| 14 |
+
"import fileinput\n",
|
| 15 |
+
"import os\n",
|
| 16 |
+
"import time\n",
|
| 17 |
+
"import base64\n",
|
| 18 |
+
"import gdown\n",
|
| 19 |
+
"from gdown.download import get_url_from_gdrive_confirmation\n",
|
| 20 |
+
"import requests\n",
|
| 21 |
+
"from urllib.request import urlopen, Request\n",
|
| 22 |
+
"from urllib.parse import urlparse, parse_qs, unquote\n",
|
| 23 |
+
"from tqdm import tqdm\n",
|
| 24 |
+
"import six\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"blsaphemy=base64.b64decode((\"ZWJ1aQ==\").encode('ascii')).decode('ascii')\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"if not os.path.exists(\"/content/gdrive\"):\n",
|
| 30 |
+
" print('\u001b[1;31mGdrive not connected, using temporary colab storage ...')\n",
|
| 31 |
+
" time.sleep(4)\n",
|
| 32 |
+
" mainpth=\"MyDrive\"\n",
|
| 33 |
+
" !mkdir -p /content/gdrive/$mainpth\n",
|
| 34 |
+
" Shared_Drive=\"\"\n",
|
| 35 |
+
"\n",
|
| 36 |
+
"if Shared_Drive!=\"\" and not os.path.exists(\"/content/gdrive/Shareddrives\"):\n",
|
| 37 |
+
" print('\u001b[1;31mShared drive not detected, using default MyDrive')\n",
|
| 38 |
+
" mainpth=\"MyDrive\"\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"with capture.capture_output() as cap:\n",
|
| 41 |
+
" def inf(msg, style, wdth): inf = widgets.Button(description=msg, disabled=True, button_style=style, layout=widgets.Layout(min_width=wdth));display(inf)\n",
|
| 42 |
+
" fgitclone = \"git clone --depth 1\"\n",
|
| 43 |
+
" %mkdir -p /content/gdrive/$mainpth/sd\n",
|
| 44 |
+
" %cd /content/gdrive/$mainpth/sd\n",
|
| 45 |
+
" !git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-w$blsaphemy\n",
|
| 46 |
+
" !mkdir -p /content/gdrive/$mainpth/sd/stable-diffusion-w$blsaphemy/cache/\n",
|
| 47 |
+
" os.environ['TRANSFORMERS_CACHE']=f\"/content/gdrive/{mainpth}/sd/stable-diffusion-w\"+blsaphemy+\"/cache\"\n",
|
| 48 |
+
" os.environ['TORCH_HOME'] = f\"/content/gdrive/{mainpth}/sd/stable-diffusion-w\"+blsaphemy+\"/cache\"\n",
|
| 49 |
+
"\n",
|
| 50 |
+
"with capture.capture_output() as cap:\n",
|
| 51 |
+
" %cd /content/gdrive/$mainpth/sd/stable-diffusion-w$blsaphemy/\n",
|
| 52 |
+
" !git reset --hard\n",
|
| 53 |
+
" !git checkout master\n",
|
| 54 |
+
" time.sleep(1)\n",
|
| 55 |
+
" !rm webui.sh\n",
|
| 56 |
+
" !git pull\n",
|
| 57 |
+
"clear_output()\n",
|
| 58 |
+
"inf('\\u2714 Done','success', '50px')"
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"cell_type": "code",
|
| 63 |
+
"execution_count": null,
|
| 64 |
+
"metadata": {},
|
| 65 |
+
"outputs": [],
|
| 66 |
+
"source": [
|
| 67 |
+
"print('\u001b[1;32mInstalling requirements...')\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"with capture.capture_output() as cap:\n",
|
| 70 |
+
" %cd /content/\n",
|
| 71 |
+
" !wget -q -i https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/Dependencies/A1111.txt\n",
|
| 72 |
+
" !dpkg -i *.deb\n",
|
| 73 |
+
" if not os.path.exists('/content/gdrive/'+mainpth+'/sd/stablediffusiond'): #restore later\n",
|
| 74 |
+
" !tar -C /content/gdrive/$mainpth --zstd -xf sd_mrep.tar.zst\n",
|
| 75 |
+
" !tar -C / --zstd -xf gcolabdeps.tar.zst\n",
|
| 76 |
+
" !rm *.deb | rm *.zst | rm *.txt\n",
|
| 77 |
+
" if not os.path.exists('gdrive/'+mainpth+'/sd/libtcmalloc/libtcmalloc_minimal.so.4'):\n",
|
| 78 |
+
" %env CXXFLAGS=-std=c++14\n",
|
| 79 |
+
" !wget -q https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz && tar zxf gperftools-2.5.tar.gz && mv gperftools-2.5 gperftools\n",
|
| 80 |
+
" !wget -q https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/Patch\n",
|
| 81 |
+
" %cd /content/gperftools\n",
|
| 82 |
+
" !patch -p1 < /content/Patch\n",
|
| 83 |
+
" !./configure --enable-minimal --enable-libunwind --enable-frame-pointers --enable-dynamic-sized-delete-support --enable-sized-delete --enable-emergency-malloc; make -j4\n",
|
| 84 |
+
" !mkdir -p /content/gdrive/$mainpth/sd/libtcmalloc && cp .libs/libtcmalloc*.so* /content/gdrive/$mainpth/sd/libtcmalloc\n",
|
| 85 |
+
" %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4\n",
|
| 86 |
+
" %cd /content\n",
|
| 87 |
+
" !rm *.tar.gz Patch && rm -r /content/gperftools\n",
|
| 88 |
+
" else:\n",
|
| 89 |
+
" %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4\n",
|
| 90 |
+
"\n",
|
| 91 |
+
" os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n",
|
| 92 |
+
" os.environ['PYTHONWARNINGS'] = 'ignore'\n",
|
| 93 |
+
" !sed -i 's@text = _formatwarnmsg(msg)@text =\\\"\\\"@g' /usr/lib/python3.10/warnings.py\n",
|
| 94 |
+
"\n",
|
| 95 |
+
"clear_output()\n",
|
| 96 |
+
"inf('\\u2714 Done','success', '50px')"
|
| 97 |
+
]
|
| 98 |
+
}
|
| 99 |
+
],
|
| 100 |
+
"metadata": {
|
| 101 |
+
"language_info": {
|
| 102 |
+
"name": "python"
|
| 103 |
+
}
|
| 104 |
+
},
|
| 105 |
+
"nbformat": 4,
|
| 106 |
+
"nbformat_minor": 2
|
| 107 |
+
}
|