bye-bye sagemaker
Browse files- files_cells/notebooks/en/auto-cleaner_en.ipynb +1 -10
- files_cells/notebooks/en/downloading_en.ipynb +4 -56
- files_cells/notebooks/en/launch_en.ipynb +34 -52
- files_cells/notebooks/en/widgets_en.ipynb +3 -6
- files_cells/notebooks/ru/auto-cleaner_ru.ipynb +1 -10
- files_cells/notebooks/ru/downloading_ru.ipynb +4 -56
- files_cells/notebooks/ru/launch_ru.ipynb +34 -52
- files_cells/notebooks/ru/widgets_ru.ipynb +3 -6
- files_cells/python/en/auto-cleaner_en.py +1 -10
- files_cells/python/en/downloading_en.py +3 -55
- files_cells/python/en/launch_en.py +34 -52
- files_cells/python/en/widgets_en.py +4 -7
- files_cells/python/ru/auto-cleaner_ru.py +1 -10
- files_cells/python/ru/downloading_ru.py +4 -56
- files_cells/python/ru/launch_ru.py +34 -52
- files_cells/python/ru/widgets_ru.py +3 -6
files_cells/notebooks/en/auto-cleaner_en.ipynb
CHANGED
|
@@ -19,14 +19,6 @@
|
|
| 19 |
"source": [
|
| 20 |
"##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##\n",
|
| 21 |
"\n",
|
| 22 |
-
"# --change log--\n",
|
| 23 |
-
"\"\"\"\n",
|
| 24 |
-
"V3.6 | 13.03.24\n",
|
| 25 |
-
"Fixed selection window\n",
|
| 26 |
-
"Dynamic update of memory display\n",
|
| 27 |
-
"\"\"\"\n",
|
| 28 |
-
"\n",
|
| 29 |
-
"\n",
|
| 30 |
"import os\n",
|
| 31 |
"import time\n",
|
| 32 |
"import ipywidgets as widgets\n",
|
|
@@ -39,8 +31,7 @@
|
|
| 39 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 40 |
" environments = {\n",
|
| 41 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 42 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 43 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 44 |
" }\n",
|
| 45 |
"\n",
|
| 46 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 19 |
"source": [
|
| 20 |
"##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##\n",
|
| 21 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"import os\n",
|
| 23 |
"import time\n",
|
| 24 |
"import ipywidgets as widgets\n",
|
|
|
|
| 31 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 32 |
" environments = {\n",
|
| 33 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 34 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 35 |
" }\n",
|
| 36 |
"\n",
|
| 37 |
" for env_var, (environment, path) in environments.items():\n",
|
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
|
@@ -37,8 +37,7 @@
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 41 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 42 |
" }\n",
|
| 43 |
"\n",
|
| 44 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -50,16 +49,6 @@
|
|
| 50 |
"# ----------------------------------------------\n",
|
| 51 |
"\n",
|
| 52 |
"\n",
|
| 53 |
-
"# === ONLY SAGEMAKER ===\n",
|
| 54 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 55 |
-
" print(\"Updating dependencies, may take some time...\")\n",
|
| 56 |
-
" !pip install -q --upgrade torchsde\n",
|
| 57 |
-
" !pip install -q --upgrade pip\n",
|
| 58 |
-
" !pip install -q --upgrade psutil\n",
|
| 59 |
-
"\n",
|
| 60 |
-
" clear_output()\n",
|
| 61 |
-
"\n",
|
| 62 |
-
"\n",
|
| 63 |
"# ================ LIBRARIES V2 ================\n",
|
| 64 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
| 65 |
"\n",
|
|
@@ -81,16 +70,6 @@
|
|
| 81 |
" \"Kaggle\": {\n",
|
| 82 |
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 83 |
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
| 84 |
-
" },\n",
|
| 85 |
-
" \"SageMaker Studio Lab\": {\n",
|
| 86 |
-
" \"opencv\": \"pip install -q opencv-python-headless\",\n",
|
| 87 |
-
" \"huggingface\": \"pip install -q huggingface-hub\",\n",
|
| 88 |
-
" \"conda_update\": \"conda update -q -n base conda\",\n",
|
| 89 |
-
" \"conda_aria2\": \"conda install -q -y aria2\",\n",
|
| 90 |
-
" \"conda_glib\": \"conda install -q -y glib\",\n",
|
| 91 |
-
" \"tensorflow\": \"pip install tensorflow\",\n",
|
| 92 |
-
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 93 |
-
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
| 94 |
" }\n",
|
| 95 |
" }\n",
|
| 96 |
"\n",
|
|
@@ -108,7 +87,6 @@
|
|
| 108 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 109 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 110 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
| 111 |
-
" !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
|
| 112 |
" del cap\n",
|
| 113 |
"\n",
|
| 114 |
" clear_output()\n",
|
|
@@ -159,11 +137,6 @@
|
|
| 159 |
"\n",
|
| 160 |
"\n",
|
| 161 |
"# ================= MAIN CODE =================\n",
|
| 162 |
-
"# --- Obsolescence warning ---\n",
|
| 163 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 164 |
-
" print(\"You are using the 'SageMaker' environment - this environment is outdated so many bugs will not be fixed and it will be cut in functionality. To save memory and/or to avoid bugs.\\n\\n\")\n",
|
| 165 |
-
"\n",
|
| 166 |
-
"\n",
|
| 167 |
"if not os.path.exists(webui_path):\n",
|
| 168 |
" start_install = int(time.time())\n",
|
| 169 |
" print(\"⌚ Unpacking Stable Diffusion...\", end='')\n",
|
|
@@ -183,8 +156,6 @@
|
|
| 183 |
" install_time = timedelta(seconds=time.time()-start_install)\n",
|
| 184 |
" print(\"\\r🚀 Unpacking is complete! For\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
|
| 185 |
"else:\n",
|
| 186 |
-
" if env == \"SageMaker Studio Lab\":\n",
|
| 187 |
-
" !echo -n {start_colab} > {webui_path}/static/colabTimer.txt\n",
|
| 188 |
" print(\"🚀 All unpacked... Skip. ⚡\")\n",
|
| 189 |
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 190 |
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
|
@@ -207,10 +178,7 @@
|
|
| 207 |
"\n",
|
| 208 |
" ## Update extensions\n",
|
| 209 |
" if latest_exstensions:\n",
|
| 210 |
-
"
|
| 211 |
-
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
| 212 |
-
" else:\n",
|
| 213 |
-
" !{'for dir in /home/studio-lab-user/content/sdw/extensions/*/; do cd \\\"$dir\\\" && git fetch origin && git pull; done'}\n",
|
| 214 |
"\n",
|
| 215 |
" # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 216 |
" %cd {webui_path}/extensions/Encrypt-Image\n",
|
|
@@ -219,7 +187,7 @@
|
|
| 219 |
" print(f\"\\r✨ {action} Completed!\")\n",
|
| 220 |
"\n",
|
| 221 |
"\n",
|
| 222 |
-
"# === FIXING
|
| 223 |
"anxety_repos = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main\"\n",
|
| 224 |
"\n",
|
| 225 |
"with capture.capture_output() as cap:\n",
|
|
@@ -228,15 +196,6 @@
|
|
| 228 |
"\n",
|
| 229 |
" # --- Additional-Networks ---\n",
|
| 230 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py\n",
|
| 231 |
-
"\n",
|
| 232 |
-
" # --= SageMaker =--\n",
|
| 233 |
-
" if env == \"SageMaker Studio Lab\":\n",
|
| 234 |
-
" with capture.capture_output() as cap:\n",
|
| 235 |
-
" # --- SuperMerger Remove ---\n",
|
| 236 |
-
" if os.path.exists(f\"{webui_path}/extensions/supermerger\"):\n",
|
| 237 |
-
" !rm -rf {webui_path}/extensions/supermerger\n",
|
| 238 |
-
" # --- Launch (Style) ---\n",
|
| 239 |
-
" !wget -O {webui_path}/modules/styles.py {anxety_repos}/sagemaker/fixing/webui/styles.py\n",
|
| 240 |
"del cap\n",
|
| 241 |
"\n",
|
| 242 |
"\n",
|
|
@@ -596,18 +555,7 @@
|
|
| 596 |
"with capture.capture_output() as cap:\n",
|
| 597 |
" for file in files_umi:\n",
|
| 598 |
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
| 599 |
-
"del cap
|
| 600 |
-
"\n",
|
| 601 |
-
"\n",
|
| 602 |
-
"# === ONLY SAGEMAKER ===\n",
|
| 603 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 604 |
-
" with capture.capture_output() as cap:\n",
|
| 605 |
-
" !rm -rf /home/studio-lab-user/.conda/envs/studiolab-safemode\n",
|
| 606 |
-
" !rm -rf /home/studio-lab-user/.conda/envs/sagemaker-distribution\n",
|
| 607 |
-
" !rm -rf /home/studio-lab-user/.conda/pkgs/cache\n",
|
| 608 |
-
" !pip cache purge\n",
|
| 609 |
-
" !rm -rf ~/.cache\n",
|
| 610 |
-
" del cap"
|
| 611 |
],
|
| 612 |
"metadata": {
|
| 613 |
"id": "2lJmbqrs3Mu8"
|
|
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 41 |
" }\n",
|
| 42 |
"\n",
|
| 43 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 49 |
"# ----------------------------------------------\n",
|
| 50 |
"\n",
|
| 51 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
"# ================ LIBRARIES V2 ================\n",
|
| 53 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
| 54 |
"\n",
|
|
|
|
| 70 |
" \"Kaggle\": {\n",
|
| 71 |
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 72 |
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
" }\n",
|
| 74 |
" }\n",
|
| 75 |
"\n",
|
|
|
|
| 87 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 88 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 89 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
|
|
|
| 90 |
" del cap\n",
|
| 91 |
"\n",
|
| 92 |
" clear_output()\n",
|
|
|
|
| 137 |
"\n",
|
| 138 |
"\n",
|
| 139 |
"# ================= MAIN CODE =================\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
"if not os.path.exists(webui_path):\n",
|
| 141 |
" start_install = int(time.time())\n",
|
| 142 |
" print(\"⌚ Unpacking Stable Diffusion...\", end='')\n",
|
|
|
|
| 156 |
" install_time = timedelta(seconds=time.time()-start_install)\n",
|
| 157 |
" print(\"\\r🚀 Unpacking is complete! For\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
|
| 158 |
"else:\n",
|
|
|
|
|
|
|
| 159 |
" print(\"🚀 All unpacked... Skip. ⚡\")\n",
|
| 160 |
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 161 |
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
|
|
|
| 178 |
"\n",
|
| 179 |
" ## Update extensions\n",
|
| 180 |
" if latest_exstensions:\n",
|
| 181 |
+
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
|
|
|
|
|
|
|
|
|
| 182 |
"\n",
|
| 183 |
" # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 184 |
" %cd {webui_path}/extensions/Encrypt-Image\n",
|
|
|
|
| 187 |
" print(f\"\\r✨ {action} Completed!\")\n",
|
| 188 |
"\n",
|
| 189 |
"\n",
|
| 190 |
+
"# === FIXING EXTENSIONS ===\n",
|
| 191 |
"anxety_repos = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main\"\n",
|
| 192 |
"\n",
|
| 193 |
"with capture.capture_output() as cap:\n",
|
|
|
|
| 196 |
"\n",
|
| 197 |
" # --- Additional-Networks ---\n",
|
| 198 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
"del cap\n",
|
| 200 |
"\n",
|
| 201 |
"\n",
|
|
|
|
| 555 |
"with capture.capture_output() as cap:\n",
|
| 556 |
" for file in files_umi:\n",
|
| 557 |
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
| 558 |
+
"del cap"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
],
|
| 560 |
"metadata": {
|
| 561 |
"id": "2lJmbqrs3Mu8"
|
files_cells/notebooks/en/launch_en.ipynb
CHANGED
|
@@ -37,8 +37,7 @@
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 41 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 42 |
" }\n",
|
| 43 |
"\n",
|
| 44 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -63,31 +62,30 @@
|
|
| 63 |
"\n",
|
| 64 |
"\n",
|
| 65 |
"# ======================== TUNNEL ========================\n",
|
| 66 |
-
"
|
| 67 |
-
"
|
| 68 |
-
"
|
| 69 |
-
"
|
| 70 |
-
"
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
-
"
|
| 74 |
-
"
|
| 75 |
-
"
|
| 76 |
-
"
|
| 77 |
-
"
|
| 78 |
-
"\n",
|
| 79 |
-
"
|
| 80 |
-
"\n",
|
| 81 |
-
"
|
| 82 |
-
"
|
| 83 |
-
"
|
| 84 |
-
"
|
| 85 |
-
"
|
| 86 |
-
"\n",
|
| 87 |
-
"
|
| 88 |
-
"
|
| 89 |
-
"
|
| 90 |
-
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
| 91 |
"# ======================== TUNNEL ========================\n",
|
| 92 |
"\n",
|
| 93 |
"\n",
|
|
@@ -98,36 +96,20 @@
|
|
| 98 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
| 99 |
"\n",
|
| 100 |
"\n",
|
| 101 |
-
"
|
| 102 |
-
"
|
| 103 |
-
"
|
| 104 |
-
" commandline_arguments += f\" --port=1769\"\n",
|
| 105 |
"\n",
|
| 106 |
-
" if ngrok_token:\n",
|
| 107 |
-
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
| 108 |
-
" if env != \"Google Colab\":\n",
|
| 109 |
-
" commandline_arguments += f\" --encrypt-pass=1769\"\n",
|
| 110 |
-
"\n",
|
| 111 |
-
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
| 112 |
-
"\n",
|
| 113 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 114 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 115 |
-
" print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
| 116 |
-
"\n",
|
| 117 |
-
"else:\n",
|
| 118 |
" if ngrok_token:\n",
|
| 119 |
-
" %cd {webui_path}\n",
|
| 120 |
-
"\n",
|
| 121 |
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
|
|
|
|
|
|
| 122 |
"\n",
|
| 123 |
-
"
|
| 124 |
-
"\n",
|
| 125 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 126 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 127 |
-
" print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
| 128 |
"\n",
|
| 129 |
-
"
|
| 130 |
-
"
|
|
|
|
| 131 |
]
|
| 132 |
}
|
| 133 |
]
|
|
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 41 |
" }\n",
|
| 42 |
"\n",
|
| 43 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 62 |
"\n",
|
| 63 |
"\n",
|
| 64 |
"# ======================== TUNNEL ========================\n",
|
| 65 |
+
"import cloudpickle as pickle\n",
|
| 66 |
+
"\n",
|
| 67 |
+
"def get_public_ip(version='ipv4'):\n",
|
| 68 |
+
" try:\n",
|
| 69 |
+
" url = f'https://api64.ipify.org?format=json&{version}=true'\n",
|
| 70 |
+
" response = requests.get(url)\n",
|
| 71 |
+
" data = response.json()\n",
|
| 72 |
+
" public_ip = data['ip']\n",
|
| 73 |
+
" return public_ip\n",
|
| 74 |
+
" except Exception as e:\n",
|
| 75 |
+
" print(f\"Error getting public {version} address:\", e)\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
| 80 |
+
"tunnel_port= 1769\n",
|
| 81 |
+
"tunnel = tunnel_class(tunnel_port)\n",
|
| 82 |
+
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
| 83 |
+
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"''' add zrok tunnel '''\n",
|
| 86 |
+
"if zrok_token:\n",
|
| 87 |
+
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
| 88 |
+
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
|
|
|
| 89 |
"# ======================== TUNNEL ========================\n",
|
| 90 |
"\n",
|
| 91 |
"\n",
|
|
|
|
| 96 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
| 97 |
"\n",
|
| 98 |
"\n",
|
| 99 |
+
"with tunnel:\n",
|
| 100 |
+
" %cd {webui_path}\n",
|
| 101 |
+
" commandline_arguments += f\" --port=1769\"\n",
|
|
|
|
| 102 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
" if ngrok_token:\n",
|
|
|
|
|
|
|
| 104 |
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
| 105 |
+
" if env != \"Google Colab\":\n",
|
| 106 |
+
" commandline_arguments += f\" --encrypt-pass=1769\"\n",
|
| 107 |
"\n",
|
| 108 |
+
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
"\n",
|
| 110 |
+
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 111 |
+
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 112 |
+
" print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")"
|
| 113 |
]
|
| 114 |
}
|
| 115 |
]
|
files_cells/notebooks/en/widgets_en.ipynb
CHANGED
|
@@ -32,8 +32,7 @@
|
|
| 32 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 33 |
" environments = {\n",
|
| 34 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 35 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 36 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 37 |
" }\n",
|
| 38 |
"\n",
|
| 39 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -71,8 +70,8 @@
|
|
| 71 |
"blur_fields = args.blur_fields\n",
|
| 72 |
"\n",
|
| 73 |
"## ---\n",
|
| 74 |
-
"\"\"\" WTF
|
| 75 |
-
"fix_heigh_img = \"-810px\" if env
|
| 76 |
"\n",
|
| 77 |
"\"\"\" transperent fields \"\"\"\n",
|
| 78 |
"t_bg_alpha = \"1\" if not args.transparent else \"0.65\"\n",
|
|
@@ -532,8 +531,6 @@
|
|
| 532 |
"additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]\n",
|
| 533 |
"if free_plan and env == \"Google Colab\": # remove ngrok from colab\n",
|
| 534 |
" additional_widget_list.remove(ngrok_widget)\n",
|
| 535 |
-
"if env == \"SageMaker Studio Lab\": # remove zrok from sagemaker\n",
|
| 536 |
-
" additional_widget_list.remove(zrok_widget)\n",
|
| 537 |
"# ```\n",
|
| 538 |
"all_additional_box = widgets.VBox(additional_widget_list).add_class(\"container\").add_class(\"image_3\")\n",
|
| 539 |
"display(all_additional_box)\n",
|
|
|
|
| 32 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 33 |
" environments = {\n",
|
| 34 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 35 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 36 |
" }\n",
|
| 37 |
"\n",
|
| 38 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 70 |
"blur_fields = args.blur_fields\n",
|
| 71 |
"\n",
|
| 72 |
"## ---\n",
|
| 73 |
+
"\"\"\" WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? \"\"\"\n",
|
| 74 |
+
"fix_heigh_img = \"-810px\" if env == \"Kaggle\" else \"-775px\"\n",
|
| 75 |
"\n",
|
| 76 |
"\"\"\" transperent fields \"\"\"\n",
|
| 77 |
"t_bg_alpha = \"1\" if not args.transparent else \"0.65\"\n",
|
|
|
|
| 531 |
"additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]\n",
|
| 532 |
"if free_plan and env == \"Google Colab\": # remove ngrok from colab\n",
|
| 533 |
" additional_widget_list.remove(ngrok_widget)\n",
|
|
|
|
|
|
|
| 534 |
"# ```\n",
|
| 535 |
"all_additional_box = widgets.VBox(additional_widget_list).add_class(\"container\").add_class(\"image_3\")\n",
|
| 536 |
"display(all_additional_box)\n",
|
files_cells/notebooks/ru/auto-cleaner_ru.ipynb
CHANGED
|
@@ -19,14 +19,6 @@
|
|
| 19 |
"source": [
|
| 20 |
"##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##\n",
|
| 21 |
"\n",
|
| 22 |
-
"# --change log--\n",
|
| 23 |
-
"\"\"\"\n",
|
| 24 |
-
"V3.6 | 13.03.24\n",
|
| 25 |
-
"Fixed selection window\n",
|
| 26 |
-
"Dynamic update of memory display\n",
|
| 27 |
-
"\"\"\"\n",
|
| 28 |
-
"\n",
|
| 29 |
-
"\n",
|
| 30 |
"import os\n",
|
| 31 |
"import time\n",
|
| 32 |
"import ipywidgets as widgets\n",
|
|
@@ -39,8 +31,7 @@
|
|
| 39 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 40 |
" environments = {\n",
|
| 41 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 42 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 43 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 44 |
" }\n",
|
| 45 |
"\n",
|
| 46 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 19 |
"source": [
|
| 20 |
"##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##\n",
|
| 21 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"import os\n",
|
| 23 |
"import time\n",
|
| 24 |
"import ipywidgets as widgets\n",
|
|
|
|
| 31 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 32 |
" environments = {\n",
|
| 33 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 34 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 35 |
" }\n",
|
| 36 |
"\n",
|
| 37 |
" for env_var, (environment, path) in environments.items():\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
|
@@ -37,8 +37,7 @@
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 41 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 42 |
" }\n",
|
| 43 |
"\n",
|
| 44 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -50,16 +49,6 @@
|
|
| 50 |
"# ----------------------------------------------\n",
|
| 51 |
"\n",
|
| 52 |
"\n",
|
| 53 |
-
"# === ONLY SAGEMAKER ===\n",
|
| 54 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 55 |
-
" print(\"Обновление зависимостей, может занять некоторое время:\")\n",
|
| 56 |
-
" !pip install -q --upgrade torchsde\n",
|
| 57 |
-
" !pip install -q --upgrade pip\n",
|
| 58 |
-
" !pip install -q --upgrade psutil\n",
|
| 59 |
-
"\n",
|
| 60 |
-
" clear_output()\n",
|
| 61 |
-
"\n",
|
| 62 |
-
"\n",
|
| 63 |
"# ================ LIBRARIES V2 ================\n",
|
| 64 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
| 65 |
"\n",
|
|
@@ -81,16 +70,6 @@
|
|
| 81 |
" \"Kaggle\": {\n",
|
| 82 |
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 83 |
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
| 84 |
-
" },\n",
|
| 85 |
-
" \"SageMaker Studio Lab\": {\n",
|
| 86 |
-
" \"opencv\": \"pip install -q opencv-python-headless\",\n",
|
| 87 |
-
" \"huggingface\": \"pip install -q huggingface-hub\",\n",
|
| 88 |
-
" \"conda_update\": \"conda update -q -n base conda\",\n",
|
| 89 |
-
" \"conda_aria2\": \"conda install -q -y aria2\",\n",
|
| 90 |
-
" \"conda_glib\": \"conda install -q -y glib\",\n",
|
| 91 |
-
" \"tensorflow\": \"pip install tensorflow\",\n",
|
| 92 |
-
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 93 |
-
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
| 94 |
" }\n",
|
| 95 |
" }\n",
|
| 96 |
"\n",
|
|
@@ -108,7 +87,6 @@
|
|
| 108 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 109 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 110 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
| 111 |
-
" !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
|
| 112 |
" del cap\n",
|
| 113 |
"\n",
|
| 114 |
" clear_output()\n",
|
|
@@ -159,11 +137,6 @@
|
|
| 159 |
"\n",
|
| 160 |
"\n",
|
| 161 |
"# ================= MAIN CODE =================\n",
|
| 162 |
-
"# --- Obsolescence warning ---\n",
|
| 163 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 164 |
-
" print(\"Вы используете среду 'SageMaker' - эта среда устарела, поэтому многие ошибки не будут исправлены, а ее функциональность будет урезана. Для экономии памяти и/или во избежание ошибок.\\n\\n\")\n",
|
| 165 |
-
"\n",
|
| 166 |
-
"\n",
|
| 167 |
"if not os.path.exists(webui_path):\n",
|
| 168 |
" start_install = int(time.time())\n",
|
| 169 |
" print(\"⌚ Распоковка Stable Diffusion...\", end='')\n",
|
|
@@ -183,8 +156,6 @@
|
|
| 183 |
" install_time = timedelta(seconds=time.time()-start_install)\n",
|
| 184 |
" print(\"\\r🚀 Распаковка Завершена! За\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
|
| 185 |
"else:\n",
|
| 186 |
-
" if env == \"SageMaker Studio Lab\":\n",
|
| 187 |
-
" !echo -n {start_colab} > {webui_path}/static/colabTimer.txt\n",
|
| 188 |
" print(\"🚀 Все распакованно... Пропуск. ⚡\")\n",
|
| 189 |
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 190 |
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
|
@@ -207,10 +178,7 @@
|
|
| 207 |
"\n",
|
| 208 |
" ## Update extensions\n",
|
| 209 |
" if latest_exstensions:\n",
|
| 210 |
-
"
|
| 211 |
-
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
| 212 |
-
" else:\n",
|
| 213 |
-
" !{'for dir in /home/studio-lab-user/content/sdw/extensions/*/; do cd \\\"$dir\\\" && git fetch origin && git pull; done'}\n",
|
| 214 |
"\n",
|
| 215 |
" # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 216 |
" %cd {webui_path}/extensions/Encrypt-Image\n",
|
|
@@ -219,7 +187,7 @@
|
|
| 219 |
" print(f\"\\r✨ {action} Завершено!\")\n",
|
| 220 |
"\n",
|
| 221 |
"\n",
|
| 222 |
-
"# === FIXING
|
| 223 |
"anxety_repos = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main\"\n",
|
| 224 |
"\n",
|
| 225 |
"with capture.capture_output() as cap:\n",
|
|
@@ -228,15 +196,6 @@
|
|
| 228 |
"\n",
|
| 229 |
" # --- Additional-Networks ---\n",
|
| 230 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py\n",
|
| 231 |
-
"\n",
|
| 232 |
-
" # --= SageMaker =--\n",
|
| 233 |
-
" if env == \"SageMaker Studio Lab\":\n",
|
| 234 |
-
" with capture.capture_output() as cap:\n",
|
| 235 |
-
" # --- SuperMerger Remove ---\n",
|
| 236 |
-
" if os.path.exists(f\"{webui_path}/extensions/supermerger\"):\n",
|
| 237 |
-
" !rm -rf {webui_path}/extensions/supermerger\n",
|
| 238 |
-
" # --- Launch (Style) ---\n",
|
| 239 |
-
" !wget -O {webui_path}/modules/styles.py {anxety_repos}/sagemaker/fixing/webui/styles.py\n",
|
| 240 |
"del cap\n",
|
| 241 |
"\n",
|
| 242 |
"\n",
|
|
@@ -596,18 +555,7 @@
|
|
| 596 |
"with capture.capture_output() as cap:\n",
|
| 597 |
" for file in files_umi:\n",
|
| 598 |
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
| 599 |
-
"del cap
|
| 600 |
-
"\n",
|
| 601 |
-
"\n",
|
| 602 |
-
"# === ONLY SAGEMAKER ===\n",
|
| 603 |
-
"if env == \"SageMaker Studio Lab\":\n",
|
| 604 |
-
" with capture.capture_output() as cap:\n",
|
| 605 |
-
" !rm -rf /home/studio-lab-user/.conda/envs/studiolab-safemode\n",
|
| 606 |
-
" !rm -rf /home/studio-lab-user/.conda/envs/sagemaker-distribution\n",
|
| 607 |
-
" !rm -rf /home/studio-lab-user/.conda/pkgs/cache\n",
|
| 608 |
-
" !pip cache purge\n",
|
| 609 |
-
" !rm -rf ~/.cache\n",
|
| 610 |
-
" del cap"
|
| 611 |
],
|
| 612 |
"metadata": {
|
| 613 |
"id": "2lJmbqrs3Mu8"
|
|
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 41 |
" }\n",
|
| 42 |
"\n",
|
| 43 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 49 |
"# ----------------------------------------------\n",
|
| 50 |
"\n",
|
| 51 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
"# ================ LIBRARIES V2 ================\n",
|
| 53 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
| 54 |
"\n",
|
|
|
|
| 70 |
" \"Kaggle\": {\n",
|
| 71 |
" \"xformers\": \"pip install -q xformers==0.0.23.post1 triton==2.1.0\",\n",
|
| 72 |
" \"torch\": \"pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121\"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
" }\n",
|
| 74 |
" }\n",
|
| 75 |
"\n",
|
|
|
|
| 87 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 88 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 89 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
|
|
|
| 90 |
" del cap\n",
|
| 91 |
"\n",
|
| 92 |
" clear_output()\n",
|
|
|
|
| 137 |
"\n",
|
| 138 |
"\n",
|
| 139 |
"# ================= MAIN CODE =================\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
"if not os.path.exists(webui_path):\n",
|
| 141 |
" start_install = int(time.time())\n",
|
| 142 |
" print(\"⌚ Распоковка Stable Diffusion...\", end='')\n",
|
|
|
|
| 156 |
" install_time = timedelta(seconds=time.time()-start_install)\n",
|
| 157 |
" print(\"\\r🚀 Распаковка Завершена! За\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
|
| 158 |
"else:\n",
|
|
|
|
|
|
|
| 159 |
" print(\"🚀 Все распакованно... Пропуск. ⚡\")\n",
|
| 160 |
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 161 |
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
|
|
|
| 178 |
"\n",
|
| 179 |
" ## Update extensions\n",
|
| 180 |
" if latest_exstensions:\n",
|
| 181 |
+
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
|
|
|
|
|
|
|
|
|
| 182 |
"\n",
|
| 183 |
" # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 184 |
" %cd {webui_path}/extensions/Encrypt-Image\n",
|
|
|
|
| 187 |
" print(f\"\\r✨ {action} Завершено!\")\n",
|
| 188 |
"\n",
|
| 189 |
"\n",
|
| 190 |
+
"# === FIXING EXTENSIONS ===\n",
|
| 191 |
"anxety_repos = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main\"\n",
|
| 192 |
"\n",
|
| 193 |
"with capture.capture_output() as cap:\n",
|
|
|
|
| 196 |
"\n",
|
| 197 |
" # --- Additional-Networks ---\n",
|
| 198 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
"del cap\n",
|
| 200 |
"\n",
|
| 201 |
"\n",
|
|
|
|
| 555 |
"with capture.capture_output() as cap:\n",
|
| 556 |
" for file in files_umi:\n",
|
| 557 |
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
| 558 |
+
"del cap"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
],
|
| 560 |
"metadata": {
|
| 561 |
"id": "2lJmbqrs3Mu8"
|
files_cells/notebooks/ru/launch_ru.ipynb
CHANGED
|
@@ -37,8 +37,7 @@
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 41 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 42 |
" }\n",
|
| 43 |
"\n",
|
| 44 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -63,31 +62,30 @@
|
|
| 63 |
"\n",
|
| 64 |
"\n",
|
| 65 |
"# ======================== TUNNEL ========================\n",
|
| 66 |
-
"
|
| 67 |
-
"
|
| 68 |
-
"
|
| 69 |
-
"
|
| 70 |
-
"
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
-
"
|
| 74 |
-
"
|
| 75 |
-
"
|
| 76 |
-
"
|
| 77 |
-
"
|
| 78 |
-
"\n",
|
| 79 |
-
"
|
| 80 |
-
"\n",
|
| 81 |
-
"
|
| 82 |
-
"
|
| 83 |
-
"
|
| 84 |
-
"
|
| 85 |
-
"
|
| 86 |
-
"\n",
|
| 87 |
-
"
|
| 88 |
-
"
|
| 89 |
-
"
|
| 90 |
-
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
| 91 |
"# ======================== TUNNEL ========================\n",
|
| 92 |
"\n",
|
| 93 |
"\n",
|
|
@@ -98,36 +96,20 @@
|
|
| 98 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
| 99 |
"\n",
|
| 100 |
"\n",
|
| 101 |
-
"
|
| 102 |
-
"
|
| 103 |
-
"
|
| 104 |
-
" commandline_arguments += f\" --port=1769\"\n",
|
| 105 |
"\n",
|
| 106 |
-
" if ngrok_token:\n",
|
| 107 |
-
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
| 108 |
-
" if env != \"Google Colab\":\n",
|
| 109 |
-
" commandline_arguments += f\" --encrypt-pass=1769\"\n",
|
| 110 |
-
"\n",
|
| 111 |
-
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
| 112 |
-
"\n",
|
| 113 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 114 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 115 |
-
" print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
| 116 |
-
"\n",
|
| 117 |
-
"else:\n",
|
| 118 |
" if ngrok_token:\n",
|
| 119 |
-
" %cd {webui_path}\n",
|
| 120 |
-
"\n",
|
| 121 |
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
|
|
|
|
|
|
| 122 |
"\n",
|
| 123 |
-
"
|
| 124 |
-
"\n",
|
| 125 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 126 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 127 |
-
" print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
| 128 |
"\n",
|
| 129 |
-
"
|
| 130 |
-
"
|
|
|
|
| 131 |
]
|
| 132 |
}
|
| 133 |
]
|
|
|
|
| 37 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 38 |
" environments = {\n",
|
| 39 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 40 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 41 |
" }\n",
|
| 42 |
"\n",
|
| 43 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 62 |
"\n",
|
| 63 |
"\n",
|
| 64 |
"# ======================== TUNNEL ========================\n",
|
| 65 |
+
"import cloudpickle as pickle\n",
|
| 66 |
+
"\n",
|
| 67 |
+
"def get_public_ip(version='ipv4'):\n",
|
| 68 |
+
" try:\n",
|
| 69 |
+
" url = f'https://api64.ipify.org?format=json&{version}=true'\n",
|
| 70 |
+
" response = requests.get(url)\n",
|
| 71 |
+
" data = response.json()\n",
|
| 72 |
+
" public_ip = data['ip']\n",
|
| 73 |
+
" return public_ip\n",
|
| 74 |
+
" except Exception as e:\n",
|
| 75 |
+
" print(f\"Error getting public {version} address:\", e)\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
| 80 |
+
"tunnel_port= 1769\n",
|
| 81 |
+
"tunnel = tunnel_class(tunnel_port)\n",
|
| 82 |
+
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
| 83 |
+
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"''' add zrok tunnel '''\n",
|
| 86 |
+
"if zrok_token:\n",
|
| 87 |
+
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
| 88 |
+
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
|
|
|
| 89 |
"# ======================== TUNNEL ========================\n",
|
| 90 |
"\n",
|
| 91 |
"\n",
|
|
|
|
| 96 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
| 97 |
"\n",
|
| 98 |
"\n",
|
| 99 |
+
"with tunnel:\n",
|
| 100 |
+
" %cd {webui_path}\n",
|
| 101 |
+
" commandline_arguments += f\" --port=1769\"\n",
|
|
|
|
| 102 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
" if ngrok_token:\n",
|
|
|
|
|
|
|
| 104 |
" commandline_arguments += ' --ngrok ' + ngrok_token\n",
|
| 105 |
+
" if env != \"Google Colab\":\n",
|
| 106 |
+
" commandline_arguments += f\" --encrypt-pass=1769\"\n",
|
| 107 |
"\n",
|
| 108 |
+
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
"\n",
|
| 110 |
+
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
| 111 |
+
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
| 112 |
+
" print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")"
|
| 113 |
]
|
| 114 |
}
|
| 115 |
]
|
files_cells/notebooks/ru/widgets_ru.ipynb
CHANGED
|
@@ -32,8 +32,7 @@
|
|
| 32 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 33 |
" environments = {\n",
|
| 34 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 35 |
-
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")
|
| 36 |
-
" 'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', \"/home/studio-lab-user/content\")\n",
|
| 37 |
" }\n",
|
| 38 |
"\n",
|
| 39 |
" for env_var, (environment, path) in environments.items():\n",
|
|
@@ -71,8 +70,8 @@
|
|
| 71 |
"blur_fields = args.blur_fields\n",
|
| 72 |
"\n",
|
| 73 |
"## ---\n",
|
| 74 |
-
"\"\"\" WTF
|
| 75 |
-
"fix_heigh_img = \"-810px\" if env
|
| 76 |
"\n",
|
| 77 |
"\"\"\" transperent fields \"\"\"\n",
|
| 78 |
"t_bg_alpha = \"1\" if not args.transparent else \"0.65\"\n",
|
|
@@ -532,8 +531,6 @@
|
|
| 532 |
"additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]\n",
|
| 533 |
"if free_plan and env == \"Google Colab\": # remove ngrok from colab\n",
|
| 534 |
" additional_widget_list.remove(ngrok_widget)\n",
|
| 535 |
-
"if env == \"SageMaker Studio Lab\": # remove zrok from sagemaker\n",
|
| 536 |
-
" additional_widget_list.remove(zrok_widget)\n",
|
| 537 |
"# ```\n",
|
| 538 |
"all_additional_box = widgets.VBox(additional_widget_list).add_class(\"container\").add_class(\"image_3\")\n",
|
| 539 |
"display(all_additional_box)\n",
|
|
|
|
| 32 |
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 33 |
" environments = {\n",
|
| 34 |
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 35 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
|
|
|
| 36 |
" }\n",
|
| 37 |
"\n",
|
| 38 |
" for env_var, (environment, path) in environments.items():\n",
|
|
|
|
| 70 |
"blur_fields = args.blur_fields\n",
|
| 71 |
"\n",
|
| 72 |
"## ---\n",
|
| 73 |
+
"\"\"\" WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? \"\"\"\n",
|
| 74 |
+
"fix_heigh_img = \"-810px\" if env == \"Kaggle\" else \"-775px\"\n",
|
| 75 |
"\n",
|
| 76 |
"\"\"\" transperent fields \"\"\"\n",
|
| 77 |
"t_bg_alpha = \"1\" if not args.transparent else \"0.65\"\n",
|
|
|
|
| 531 |
"additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]\n",
|
| 532 |
"if free_plan and env == \"Google Colab\": # remove ngrok from colab\n",
|
| 533 |
" additional_widget_list.remove(ngrok_widget)\n",
|
|
|
|
|
|
|
| 534 |
"# ```\n",
|
| 535 |
"all_additional_box = widgets.VBox(additional_widget_list).add_class(\"container\").add_class(\"image_3\")\n",
|
| 536 |
"display(all_additional_box)\n",
|
files_cells/python/en/auto-cleaner_en.py
CHANGED
|
@@ -1,13 +1,5 @@
|
|
| 1 |
##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##
|
| 2 |
|
| 3 |
-
# --change log--
|
| 4 |
-
"""
|
| 5 |
-
V3.6 | 13.03.24
|
| 6 |
-
Fixed selection window
|
| 7 |
-
Dynamic update of memory display
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
|
| 11 |
import os
|
| 12 |
import time
|
| 13 |
import ipywidgets as widgets
|
|
@@ -20,8 +12,7 @@ def detect_environment():
|
|
| 20 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 21 |
environments = {
|
| 22 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 23 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 24 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 25 |
}
|
| 26 |
|
| 27 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 1 |
##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import os
|
| 4 |
import time
|
| 5 |
import ipywidgets as widgets
|
|
|
|
| 12 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 13 |
environments = {
|
| 14 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 15 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
for env_var, (environment, path) in environments.items():
|
files_cells/python/en/downloading_en.py
CHANGED
|
@@ -18,8 +18,7 @@ def detect_environment():
|
|
| 18 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 19 |
environments = {
|
| 20 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 21 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 22 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 23 |
}
|
| 24 |
|
| 25 |
for env_var, (environment, path) in environments.items():
|
|
@@ -31,16 +30,6 @@ webui_path = f"{root_path}/sdw"
|
|
| 31 |
# ----------------------------------------------
|
| 32 |
|
| 33 |
|
| 34 |
-
# === ONLY SAGEMAKER ===
|
| 35 |
-
if env == "SageMaker Studio Lab":
|
| 36 |
-
print("Updating dependencies, may take some time...")
|
| 37 |
-
get_ipython().system('pip install -q --upgrade torchsde')
|
| 38 |
-
get_ipython().system('pip install -q --upgrade pip')
|
| 39 |
-
get_ipython().system('pip install -q --upgrade psutil')
|
| 40 |
-
|
| 41 |
-
clear_output()
|
| 42 |
-
|
| 43 |
-
|
| 44 |
# ================ LIBRARIES V2 ================
|
| 45 |
flag_file = f"{root_path}/libraries_installed.txt"
|
| 46 |
|
|
@@ -62,16 +51,6 @@ if not os.path.exists(flag_file):
|
|
| 62 |
"Kaggle": {
|
| 63 |
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 64 |
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
| 65 |
-
},
|
| 66 |
-
"SageMaker Studio Lab": {
|
| 67 |
-
"opencv": "pip install -q opencv-python-headless",
|
| 68 |
-
"huggingface": "pip install -q huggingface-hub",
|
| 69 |
-
"conda_update": "conda update -q -n base conda",
|
| 70 |
-
"conda_aria2": "conda install -q -y aria2",
|
| 71 |
-
"conda_glib": "conda install -q -y glib",
|
| 72 |
-
"tensorflow": "pip install tensorflow",
|
| 73 |
-
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 74 |
-
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
| 75 |
}
|
| 76 |
}
|
| 77 |
|
|
@@ -89,7 +68,6 @@ if not os.path.exists(flag_file):
|
|
| 89 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 90 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 91 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
| 92 |
-
get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
|
| 93 |
del cap
|
| 94 |
|
| 95 |
clear_output()
|
|
@@ -140,11 +118,6 @@ control_dir = f"{webui_path}/models/ControlNet"
|
|
| 140 |
|
| 141 |
|
| 142 |
# ================= MAIN CODE =================
|
| 143 |
-
# --- Obsolescence warning ---
|
| 144 |
-
if env == "SageMaker Studio Lab":
|
| 145 |
-
print("You are using the 'SageMaker' environment - this environment is outdated so many bugs will not be fixed and it will be cut in functionality. To save memory and/or to avoid bugs.\n\n")
|
| 146 |
-
|
| 147 |
-
|
| 148 |
if not os.path.exists(webui_path):
|
| 149 |
start_install = int(time.time())
|
| 150 |
print("⌚ Unpacking Stable Diffusion...", end='')
|
|
@@ -164,8 +137,6 @@ if not os.path.exists(webui_path):
|
|
| 164 |
install_time = timedelta(seconds=time.time()-start_install)
|
| 165 |
print("\r🚀 Unpacking is complete! For","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
|
| 166 |
else:
|
| 167 |
-
if env == "SageMaker Studio Lab":
|
| 168 |
-
get_ipython().system('echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 169 |
print("🚀 All unpacked... Skip. ⚡")
|
| 170 |
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 171 |
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
|
@@ -188,10 +159,7 @@ if latest_webui or latest_exstensions:
|
|
| 188 |
|
| 189 |
## Update extensions
|
| 190 |
if latest_exstensions:
|
| 191 |
-
|
| 192 |
-
get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
|
| 193 |
-
else:
|
| 194 |
-
get_ipython().system('{\'for dir in /home/studio-lab-user/content/sdw/extensions/*/; do cd \\"$dir\\" && git fetch origin && git pull; done\'}')
|
| 195 |
|
| 196 |
# My Chinese friend, you broke the images again in the latest update... >W<'
|
| 197 |
get_ipython().run_line_magic('cd', '{webui_path}/extensions/Encrypt-Image')
|
|
@@ -200,7 +168,7 @@ if latest_webui or latest_exstensions:
|
|
| 200 |
print(f"\r✨ {action} Completed!")
|
| 201 |
|
| 202 |
|
| 203 |
-
# === FIXING
|
| 204 |
anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
| 205 |
|
| 206 |
with capture.capture_output() as cap:
|
|
@@ -209,15 +177,6 @@ with capture.capture_output() as cap:
|
|
| 209 |
|
| 210 |
# --- Additional-Networks ---
|
| 211 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py')
|
| 212 |
-
|
| 213 |
-
# --= SageMaker =--
|
| 214 |
-
if env == "SageMaker Studio Lab":
|
| 215 |
-
with capture.capture_output() as cap:
|
| 216 |
-
# --- SuperMerger Remove ---
|
| 217 |
-
if os.path.exists(f"{webui_path}/extensions/supermerger"):
|
| 218 |
-
get_ipython().system('rm -rf {webui_path}/extensions/supermerger')
|
| 219 |
-
# --- Launch (Style) ---
|
| 220 |
-
get_ipython().system('wget -O {webui_path}/modules/styles.py {anxety_repos}/sagemaker/fixing/webui/styles.py')
|
| 221 |
del cap
|
| 222 |
|
| 223 |
|
|
@@ -576,14 +535,3 @@ with capture.capture_output() as cap:
|
|
| 576 |
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
| 577 |
del cap
|
| 578 |
|
| 579 |
-
|
| 580 |
-
# === ONLY SAGEMAKER ===
|
| 581 |
-
if env == "SageMaker Studio Lab":
|
| 582 |
-
with capture.capture_output() as cap:
|
| 583 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/envs/studiolab-safemode')
|
| 584 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/envs/sagemaker-distribution')
|
| 585 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/pkgs/cache')
|
| 586 |
-
get_ipython().system('pip cache purge')
|
| 587 |
-
get_ipython().system('rm -rf ~/.cache')
|
| 588 |
-
del cap
|
| 589 |
-
|
|
|
|
| 18 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 19 |
environments = {
|
| 20 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 21 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 30 |
# ----------------------------------------------
|
| 31 |
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# ================ LIBRARIES V2 ================
|
| 34 |
flag_file = f"{root_path}/libraries_installed.txt"
|
| 35 |
|
|
|
|
| 51 |
"Kaggle": {
|
| 52 |
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 53 |
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
|
|
|
| 68 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 69 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 70 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
|
|
|
| 71 |
del cap
|
| 72 |
|
| 73 |
clear_output()
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
# ================= MAIN CODE =================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if not os.path.exists(webui_path):
|
| 122 |
start_install = int(time.time())
|
| 123 |
print("⌚ Unpacking Stable Diffusion...", end='')
|
|
|
|
| 137 |
install_time = timedelta(seconds=time.time()-start_install)
|
| 138 |
print("\r🚀 Unpacking is complete! For","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
|
| 139 |
else:
|
|
|
|
|
|
|
| 140 |
print("🚀 All unpacked... Skip. ⚡")
|
| 141 |
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 142 |
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
|
|
|
| 159 |
|
| 160 |
## Update extensions
|
| 161 |
if latest_exstensions:
|
| 162 |
+
get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
# My Chinese friend, you broke the images again in the latest update... >W<'
|
| 165 |
get_ipython().run_line_magic('cd', '{webui_path}/extensions/Encrypt-Image')
|
|
|
|
| 168 |
print(f"\r✨ {action} Completed!")
|
| 169 |
|
| 170 |
|
| 171 |
+
# === FIXING EXTENSIONS ===
|
| 172 |
anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
| 173 |
|
| 174 |
with capture.capture_output() as cap:
|
|
|
|
| 177 |
|
| 178 |
# --- Additional-Networks ---
|
| 179 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
del cap
|
| 181 |
|
| 182 |
|
|
|
|
| 535 |
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
| 536 |
del cap
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
files_cells/python/en/launch_en.py
CHANGED
|
@@ -13,8 +13,7 @@ def detect_environment():
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 17 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 18 |
}
|
| 19 |
|
| 20 |
for env_var, (environment, path) in environments.items():
|
|
@@ -39,31 +38,30 @@ commandline_arguments = settings['commandline_arguments']
|
|
| 39 |
|
| 40 |
|
| 41 |
# ======================== TUNNEL ========================
|
| 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 |
-
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
| 67 |
# ======================== TUNNEL ========================
|
| 68 |
|
| 69 |
|
|
@@ -74,34 +72,18 @@ get_ipython().system('sed -i \'s#"additional_networks_extra_lora_path": ".*model
|
|
| 74 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
| 75 |
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
commandline_arguments += f" --port=1769"
|
| 81 |
|
| 82 |
-
if ngrok_token:
|
| 83 |
-
commandline_arguments += ' --ngrok ' + ngrok_token
|
| 84 |
-
if env != "Google Colab":
|
| 85 |
-
commandline_arguments += f" --encrypt-pass=1769"
|
| 86 |
-
|
| 87 |
-
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
| 88 |
-
|
| 89 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 90 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 91 |
-
print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
|
| 92 |
-
|
| 93 |
-
else:
|
| 94 |
if ngrok_token:
|
| 95 |
-
get_ipython().run_line_magic('cd', '{webui_path}')
|
| 96 |
-
|
| 97 |
commandline_arguments += ' --ngrok ' + ngrok_token
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 102 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 103 |
-
print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
| 107 |
|
|
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
# ======================== TUNNEL ========================
|
| 41 |
+
import cloudpickle as pickle
|
| 42 |
+
|
| 43 |
+
def get_public_ip(version='ipv4'):
|
| 44 |
+
try:
|
| 45 |
+
url = f'https://api64.ipify.org?format=json&{version}=true'
|
| 46 |
+
response = requests.get(url)
|
| 47 |
+
data = response.json()
|
| 48 |
+
public_ip = data['ip']
|
| 49 |
+
return public_ip
|
| 50 |
+
except Exception as e:
|
| 51 |
+
print(f"Error getting public {version} address:", e)
|
| 52 |
+
|
| 53 |
+
public_ipv4 = get_public_ip(version='ipv4')
|
| 54 |
+
|
| 55 |
+
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
| 56 |
+
tunnel_port= 1769
|
| 57 |
+
tunnel = tunnel_class(tunnel_port)
|
| 58 |
+
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
| 59 |
+
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
| 60 |
+
|
| 61 |
+
''' add zrok tunnel '''
|
| 62 |
+
if zrok_token:
|
| 63 |
+
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
| 64 |
+
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
|
|
|
| 65 |
# ======================== TUNNEL ========================
|
| 66 |
|
| 67 |
|
|
|
|
| 72 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
| 73 |
|
| 74 |
|
| 75 |
+
with tunnel:
|
| 76 |
+
get_ipython().run_line_magic('cd', '{webui_path}')
|
| 77 |
+
commandline_arguments += f" --port=1769"
|
|
|
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
if ngrok_token:
|
|
|
|
|
|
|
| 80 |
commandline_arguments += ' --ngrok ' + ngrok_token
|
| 81 |
+
if env != "Google Colab":
|
| 82 |
+
commandline_arguments += f" --encrypt-pass=1769"
|
| 83 |
|
| 84 |
+
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 87 |
+
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 88 |
+
print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
|
| 89 |
|
files_cells/python/en/widgets_en.py
CHANGED
|
@@ -13,8 +13,7 @@ def detect_environment():
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 17 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 18 |
}
|
| 19 |
|
| 20 |
for env_var, (environment, path) in environments.items():
|
|
@@ -38,7 +37,7 @@ parser.add_argument('-b', '--blur', type=str, help='Blur level for the image', m
|
|
| 38 |
parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0)
|
| 39 |
parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0)
|
| 40 |
parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100)
|
| 41 |
-
parser.add_argument('-m', '--mode',action='store_true', help='Removes repetitive image tiles')
|
| 42 |
parser.add_argument('-t', '--transparent', action='store_true', help='Makes input/selection fields 35%% more transparent')
|
| 43 |
parser.add_argument('-bf', '--blur-fields', type=str, help='Background blur level for input/selection fields', metavar='', default=2)
|
| 44 |
args = parser.parse_args()
|
|
@@ -52,8 +51,8 @@ scale_img = args.scale
|
|
| 52 |
blur_fields = args.blur_fields
|
| 53 |
|
| 54 |
## ---
|
| 55 |
-
""" WTF
|
| 56 |
-
fix_heigh_img = "-810px" if env
|
| 57 |
|
| 58 |
""" transperent fields """
|
| 59 |
t_bg_alpha = "1" if not args.transparent else "0.65"
|
|
@@ -513,8 +512,6 @@ commandline_arguments_widget = widgets.Text(description='Arguments:', value=comm
|
|
| 513 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]
|
| 514 |
if free_plan and env == "Google Colab": # remove ngrok from colab
|
| 515 |
additional_widget_list.remove(ngrok_widget)
|
| 516 |
-
if env == "SageMaker Studio Lab": # remove zrok from sagemaker
|
| 517 |
-
additional_widget_list.remove(zrok_widget)
|
| 518 |
# ```
|
| 519 |
all_additional_box = widgets.VBox(additional_widget_list).add_class("container").add_class("image_3")
|
| 520 |
display(all_additional_box)
|
|
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 37 |
parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0)
|
| 38 |
parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0)
|
| 39 |
parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100)
|
| 40 |
+
parser.add_argument('-m', '--mode', action='store_true', help='Removes repetitive image tiles')
|
| 41 |
parser.add_argument('-t', '--transparent', action='store_true', help='Makes input/selection fields 35%% more transparent')
|
| 42 |
parser.add_argument('-bf', '--blur-fields', type=str, help='Background blur level for input/selection fields', metavar='', default=2)
|
| 43 |
args = parser.parse_args()
|
|
|
|
| 51 |
blur_fields = args.blur_fields
|
| 52 |
|
| 53 |
## ---
|
| 54 |
+
""" WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? """
|
| 55 |
+
fix_heigh_img = "-810px" if env == "Kaggle" else "-775px"
|
| 56 |
|
| 57 |
""" transperent fields """
|
| 58 |
t_bg_alpha = "1" if not args.transparent else "0.65"
|
|
|
|
| 512 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]
|
| 513 |
if free_plan and env == "Google Colab": # remove ngrok from colab
|
| 514 |
additional_widget_list.remove(ngrok_widget)
|
|
|
|
|
|
|
| 515 |
# ```
|
| 516 |
all_additional_box = widgets.VBox(additional_widget_list).add_class("container").add_class("image_3")
|
| 517 |
display(all_additional_box)
|
files_cells/python/ru/auto-cleaner_ru.py
CHANGED
|
@@ -1,13 +1,5 @@
|
|
| 1 |
##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##
|
| 2 |
|
| 3 |
-
# --change log--
|
| 4 |
-
"""
|
| 5 |
-
V3.6 | 13.03.24
|
| 6 |
-
Fixed selection window
|
| 7 |
-
Dynamic update of memory display
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
|
| 11 |
import os
|
| 12 |
import time
|
| 13 |
import ipywidgets as widgets
|
|
@@ -20,8 +12,7 @@ def detect_environment():
|
|
| 20 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 21 |
environments = {
|
| 22 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 23 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 24 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 25 |
}
|
| 26 |
|
| 27 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 1 |
##~ AutoCleaner V3.6 CODE | BY: ANXETY ~##
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import os
|
| 4 |
import time
|
| 5 |
import ipywidgets as widgets
|
|
|
|
| 12 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 13 |
environments = {
|
| 14 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 15 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
for env_var, (environment, path) in environments.items():
|
files_cells/python/ru/downloading_ru.py
CHANGED
|
@@ -18,8 +18,7 @@ def detect_environment():
|
|
| 18 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 19 |
environments = {
|
| 20 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 21 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 22 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 23 |
}
|
| 24 |
|
| 25 |
for env_var, (environment, path) in environments.items():
|
|
@@ -31,21 +30,11 @@ webui_path = f"{root_path}/sdw"
|
|
| 31 |
# ----------------------------------------------
|
| 32 |
|
| 33 |
|
| 34 |
-
# === ONLY SAGEMAKER ===
|
| 35 |
-
if env == "SageMaker Studio Lab":
|
| 36 |
-
print("Обновление зависимостей, может занять некоторое время...")
|
| 37 |
-
get_ipython().system('pip install -q --upgrade torchsde')
|
| 38 |
-
get_ipython().system('pip install -q --upgrade pip')
|
| 39 |
-
get_ipython().system('pip install -q --upgrade psutil')
|
| 40 |
-
|
| 41 |
-
clear_output()
|
| 42 |
-
|
| 43 |
-
|
| 44 |
# ================ LIBRARIES V2 ================
|
| 45 |
flag_file = f"{root_path}/libraries_installed.txt"
|
| 46 |
|
| 47 |
if not os.path.exists(flag_file):
|
| 48 |
-
print("💿 Установка библиотек, это займет какое-то
|
| 49 |
|
| 50 |
install_lib = {
|
| 51 |
"gdown": "pip install -U gdown",
|
|
@@ -62,16 +51,6 @@ if not os.path.exists(flag_file):
|
|
| 62 |
"Kaggle": {
|
| 63 |
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 64 |
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
| 65 |
-
},
|
| 66 |
-
"SageMaker Studio Lab": {
|
| 67 |
-
"opencv": "pip install -q opencv-python-headless",
|
| 68 |
-
"huggingface": "pip install -q huggingface-hub",
|
| 69 |
-
"conda_update": "conda update -q -n base conda",
|
| 70 |
-
"conda_aria2": "conda install -q -y aria2",
|
| 71 |
-
"conda_glib": "conda install -q -y glib",
|
| 72 |
-
"tensorflow": "pip install tensorflow",
|
| 73 |
-
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 74 |
-
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
| 75 |
}
|
| 76 |
}
|
| 77 |
|
|
@@ -89,7 +68,6 @@ if not os.path.exists(flag_file):
|
|
| 89 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 90 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 91 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
| 92 |
-
get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
|
| 93 |
del cap
|
| 94 |
|
| 95 |
clear_output()
|
|
@@ -140,11 +118,6 @@ control_dir = f"{webui_path}/models/ControlNet"
|
|
| 140 |
|
| 141 |
|
| 142 |
# ================= MAIN CODE =================
|
| 143 |
-
# --- Obsolescence warning ---
|
| 144 |
-
if env == "SageMaker Studio Lab":
|
| 145 |
-
print("Вы используете среду 'SageMaker' - эта среда устарела, поэтому многие ошибки не будут исправлены, а ее функциональность будет урезана. Для экономии памяти и/или во избежание ошибок.\n\n")
|
| 146 |
-
|
| 147 |
-
|
| 148 |
if not os.path.exists(webui_path):
|
| 149 |
start_install = int(time.time())
|
| 150 |
print("⌚ Распоковка Stable Diffusion...", end='')
|
|
@@ -164,8 +137,6 @@ if not os.path.exists(webui_path):
|
|
| 164 |
install_time = timedelta(seconds=time.time()-start_install)
|
| 165 |
print("\r🚀 Распаковка Завершена! За","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
|
| 166 |
else:
|
| 167 |
-
if env == "SageMaker Studio Lab":
|
| 168 |
-
get_ipython().system('echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 169 |
print("🚀 Все распакованно... Пропуск. ⚡")
|
| 170 |
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 171 |
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
|
@@ -188,10 +159,7 @@ if latest_webui or latest_exstensions:
|
|
| 188 |
|
| 189 |
## Update extensions
|
| 190 |
if latest_exstensions:
|
| 191 |
-
|
| 192 |
-
get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
|
| 193 |
-
else:
|
| 194 |
-
get_ipython().system('{\'for dir in /home/studio-lab-user/content/sdw/extensions/*/; do cd \\"$dir\\" && git fetch origin && git pull; done\'}')
|
| 195 |
|
| 196 |
# My Chinese friend, you broke the images again in the latest update... >W<'
|
| 197 |
get_ipython().run_line_magic('cd', '{webui_path}/extensions/Encrypt-Image')
|
|
@@ -200,7 +168,7 @@ if latest_webui or latest_exstensions:
|
|
| 200 |
print(f"\r✨ {action} Завершено!")
|
| 201 |
|
| 202 |
|
| 203 |
-
# === FIXING
|
| 204 |
anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
| 205 |
|
| 206 |
with capture.capture_output() as cap:
|
|
@@ -209,15 +177,6 @@ with capture.capture_output() as cap:
|
|
| 209 |
|
| 210 |
# --- Additional-Networks ---
|
| 211 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py')
|
| 212 |
-
|
| 213 |
-
# --= SageMaker =--
|
| 214 |
-
if env == "SageMaker Studio Lab":
|
| 215 |
-
with capture.capture_output() as cap:
|
| 216 |
-
# --- SuperMerger Remove ---
|
| 217 |
-
if os.path.exists(f"{webui_path}/extensions/supermerger"):
|
| 218 |
-
get_ipython().system('rm -rf {webui_path}/extensions/supermerger')
|
| 219 |
-
# --- Launch (Style) ---
|
| 220 |
-
get_ipython().system('wget -O {webui_path}/modules/styles.py {anxety_repos}/sagemaker/fixing/webui/styles.py')
|
| 221 |
del cap
|
| 222 |
|
| 223 |
|
|
@@ -576,14 +535,3 @@ with capture.capture_output() as cap:
|
|
| 576 |
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
| 577 |
del cap
|
| 578 |
|
| 579 |
-
|
| 580 |
-
# === ONLY SAGEMAKER ===
|
| 581 |
-
if env == "SageMaker Studio Lab":
|
| 582 |
-
with capture.capture_output() as cap:
|
| 583 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/envs/studiolab-safemode')
|
| 584 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/envs/sagemaker-distribution')
|
| 585 |
-
get_ipython().system('rm -rf /home/studio-lab-user/.conda/pkgs/cache')
|
| 586 |
-
get_ipython().system('pip cache purge')
|
| 587 |
-
get_ipython().system('rm -rf ~/.cache')
|
| 588 |
-
del cap
|
| 589 |
-
|
|
|
|
| 18 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 19 |
environments = {
|
| 20 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 21 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 30 |
# ----------------------------------------------
|
| 31 |
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# ================ LIBRARIES V2 ================
|
| 34 |
flag_file = f"{root_path}/libraries_installed.txt"
|
| 35 |
|
| 36 |
if not os.path.exists(flag_file):
|
| 37 |
+
print("💿 Установка библиотек, это займет какое-то время...\n")
|
| 38 |
|
| 39 |
install_lib = {
|
| 40 |
"gdown": "pip install -U gdown",
|
|
|
|
| 51 |
"Kaggle": {
|
| 52 |
"xformers": "pip install -q xformers==0.0.23.post1 triton==2.1.0",
|
| 53 |
"torch": "pip install -q torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
|
|
|
| 68 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 69 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 70 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
|
|
|
| 71 |
del cap
|
| 72 |
|
| 73 |
clear_output()
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
# ================= MAIN CODE =================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if not os.path.exists(webui_path):
|
| 122 |
start_install = int(time.time())
|
| 123 |
print("⌚ Распоковка Stable Diffusion...", end='')
|
|
|
|
| 137 |
install_time = timedelta(seconds=time.time()-start_install)
|
| 138 |
print("\r🚀 Распаковка Завершена! За","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
|
| 139 |
else:
|
|
|
|
|
|
|
| 140 |
print("🚀 Все распакованно... Пропуск. ⚡")
|
| 141 |
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 142 |
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
|
|
|
| 159 |
|
| 160 |
## Update extensions
|
| 161 |
if latest_exstensions:
|
| 162 |
+
get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
# My Chinese friend, you broke the images again in the latest update... >W<'
|
| 165 |
get_ipython().run_line_magic('cd', '{webui_path}/extensions/Encrypt-Image')
|
|
|
|
| 168 |
print(f"\r✨ {action} Завершено!")
|
| 169 |
|
| 170 |
|
| 171 |
+
# === FIXING EXTENSIONS ===
|
| 172 |
anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
| 173 |
|
| 174 |
with capture.capture_output() as cap:
|
|
|
|
| 177 |
|
| 178 |
# --- Additional-Networks ---
|
| 179 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
del cap
|
| 181 |
|
| 182 |
|
|
|
|
| 535 |
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
| 536 |
del cap
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
files_cells/python/ru/launch_ru.py
CHANGED
|
@@ -13,8 +13,7 @@ def detect_environment():
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 17 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 18 |
}
|
| 19 |
|
| 20 |
for env_var, (environment, path) in environments.items():
|
|
@@ -39,31 +38,30 @@ commandline_arguments = settings['commandline_arguments']
|
|
| 39 |
|
| 40 |
|
| 41 |
# ======================== TUNNEL ========================
|
| 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 |
-
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
| 67 |
# ======================== TUNNEL ========================
|
| 68 |
|
| 69 |
|
|
@@ -74,34 +72,18 @@ get_ipython().system('sed -i \'s#"additional_networks_extra_lora_path": ".*model
|
|
| 74 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
| 75 |
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
commandline_arguments += f" --port=1769"
|
| 81 |
|
| 82 |
-
if ngrok_token:
|
| 83 |
-
commandline_arguments += ' --ngrok ' + ngrok_token
|
| 84 |
-
if env != "Google Colab":
|
| 85 |
-
commandline_arguments += f" --encrypt-pass=1769"
|
| 86 |
-
|
| 87 |
-
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
| 88 |
-
|
| 89 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 90 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 91 |
-
print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
|
| 92 |
-
|
| 93 |
-
else:
|
| 94 |
if ngrok_token:
|
| 95 |
-
get_ipython().run_line_magic('cd', '{webui_path}')
|
| 96 |
-
|
| 97 |
commandline_arguments += ' --ngrok ' + ngrok_token
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 102 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 103 |
-
print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
| 107 |
|
|
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
# ======================== TUNNEL ========================
|
| 41 |
+
import cloudpickle as pickle
|
| 42 |
+
|
| 43 |
+
def get_public_ip(version='ipv4'):
|
| 44 |
+
try:
|
| 45 |
+
url = f'https://api64.ipify.org?format=json&{version}=true'
|
| 46 |
+
response = requests.get(url)
|
| 47 |
+
data = response.json()
|
| 48 |
+
public_ip = data['ip']
|
| 49 |
+
return public_ip
|
| 50 |
+
except Exception as e:
|
| 51 |
+
print(f"Error getting public {version} address:", e)
|
| 52 |
+
|
| 53 |
+
public_ipv4 = get_public_ip(version='ipv4')
|
| 54 |
+
|
| 55 |
+
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
| 56 |
+
tunnel_port= 1769
|
| 57 |
+
tunnel = tunnel_class(tunnel_port)
|
| 58 |
+
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
| 59 |
+
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
| 60 |
+
|
| 61 |
+
''' add zrok tunnel '''
|
| 62 |
+
if zrok_token:
|
| 63 |
+
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
| 64 |
+
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
|
|
|
| 65 |
# ======================== TUNNEL ========================
|
| 66 |
|
| 67 |
|
|
|
|
| 72 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
| 73 |
|
| 74 |
|
| 75 |
+
with tunnel:
|
| 76 |
+
get_ipython().run_line_magic('cd', '{webui_path}')
|
| 77 |
+
commandline_arguments += f" --port=1769"
|
|
|
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
if ngrok_token:
|
|
|
|
|
|
|
| 80 |
commandline_arguments += ' --ngrok ' + ngrok_token
|
| 81 |
+
if env != "Google Colab":
|
| 82 |
+
commandline_arguments += f" --encrypt-pass=1769"
|
| 83 |
|
| 84 |
+
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
| 87 |
+
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
| 88 |
+
print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
|
| 89 |
|
files_cells/python/ru/widgets_ru.py
CHANGED
|
@@ -13,8 +13,7 @@ def detect_environment():
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
-
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 17 |
-
'SAGEMAKER_INTERNAL_IMAGE_URI': ('SageMaker Studio Lab', "/home/studio-lab-user/content")
|
| 18 |
}
|
| 19 |
|
| 20 |
for env_var, (environment, path) in environments.items():
|
|
@@ -52,8 +51,8 @@ scale_img = args.scale
|
|
| 52 |
blur_fields = args.blur_fields
|
| 53 |
|
| 54 |
## ---
|
| 55 |
-
""" WTF
|
| 56 |
-
fix_heigh_img = "-810px" if env
|
| 57 |
|
| 58 |
""" transperent fields """
|
| 59 |
t_bg_alpha = "1" if not args.transparent else "0.65"
|
|
@@ -513,8 +512,6 @@ commandline_arguments_widget = widgets.Text(description='Аргументы:', v
|
|
| 513 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]
|
| 514 |
if free_plan and env == "Google Colab": # remove ngrok from colab
|
| 515 |
additional_widget_list.remove(ngrok_widget)
|
| 516 |
-
if env == "SageMaker Studio Lab": # remove zrok from sagemaker
|
| 517 |
-
additional_widget_list.remove(zrok_widget)
|
| 518 |
# ```
|
| 519 |
all_additional_box = widgets.VBox(additional_widget_list).add_class("container").add_class("image_3")
|
| 520 |
display(all_additional_box)
|
|
|
|
| 13 |
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 14 |
environments = {
|
| 15 |
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 16 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
for env_var, (environment, path) in environments.items():
|
|
|
|
| 51 |
blur_fields = args.blur_fields
|
| 52 |
|
| 53 |
## ---
|
| 54 |
+
""" WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? """
|
| 55 |
+
fix_heigh_img = "-810px" if env == "Kaggle" else "-775px"
|
| 56 |
|
| 57 |
""" transperent fields """
|
| 58 |
t_bg_alpha = "1" if not args.transparent else "0.65"
|
|
|
|
| 512 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, zrok_widget, HR, commandline_arguments_widget]
|
| 513 |
if free_plan and env == "Google Colab": # remove ngrok from colab
|
| 514 |
additional_widget_list.remove(ngrok_widget)
|
|
|
|
|
|
|
| 515 |
# ```
|
| 516 |
all_additional_box = widgets.VBox(additional_widget_list).add_class("container").add_class("image_3")
|
| 517 |
display(all_additional_box)
|