johnslegers commited on
Commit
29c8b6c
·
1 Parent(s): ac0503d
config/Start Stable Diffusion UI.cmd ADDED
@@ -0,0 +1 @@
 
 
1
+ installer\Scripts\activate.bat
config/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"model": {"stable-diffusion": "sd-v1-4"}}
config/install_status.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ sd_ui_git_cloned
2
+ sd_git_cloned
3
+ conda_sd_env_created
4
+ conda_sd_gfpgan_deps_installed
5
+ conda_sd_esrgan_deps_installed
6
+ conda_sd_ui_deps_installed
7
+ sd_weights_downloaded
8
+ sd_install_complete
{ui/scripts → config}/on_env_start.bat RENAMED
File without changes
{ui/scripts → config}/on_env_start.sh RENAMED
@@ -37,7 +37,6 @@ rm -rf ui
37
  cp -Rf sd-ui-files/ui .
38
  cp sd-ui-files/scripts/on_sd_start.sh scripts/
39
  cp sd-ui-files/scripts/start.sh .
40
- cp sd-ui-files/scripts/developer_console.sh .
41
 
42
  ./scripts/on_sd_start.sh
43
 
 
37
  cp -Rf sd-ui-files/ui .
38
  cp sd-ui-files/scripts/on_sd_start.sh scripts/
39
  cp sd-ui-files/scripts/start.sh .
 
40
 
41
  ./scripts/on_sd_start.sh
42
 
{ui/scripts → config}/on_sd_start.bat RENAMED
File without changes
{ui/scripts → config}/on_sd_start.sh RENAMED
@@ -4,12 +4,7 @@ cp sd-ui-files/scripts/on_env_start.sh scripts/
4
 
5
  source installer/etc/profile.d/conda.sh
6
 
7
- cp sd-ui-files/scripts/developer_console.sh .
8
- if [ -e "open_dev_console.sh" ]; then
9
- rm "open_dev_console.sh"
10
- fi
11
-
12
- python -c "import os; import shutil; frm = 'sd-ui-files/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'; dst = os.path.join(os.path.expanduser('~'), '.cache', 'huggingface', 'transformers', '9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'); shutil.copyfile(frm, dst) if os.path.exists(dst) else print(''); print('Hotfixed broken JSON file from OpenAI');"
13
 
14
  # Caution, this file will make your eyes and brain bleed. It's such an unholy mess.
15
  # Note to self: Please rewrite this in Python. For the sake of your own sanity.
@@ -21,10 +16,7 @@ if [ -e "scripts/install_status.txt" ] && [ `grep -c sd_git_cloned scripts/insta
21
 
22
  git reset --hard
23
  git pull
24
- git checkout f6cfebffa752ee11a7b07497b8529d5971de916c
25
-
26
- git apply ../ui/sd_internal/ddim_callback.patch
27
- git apply ../ui/sd_internal/env_yaml.patch
28
 
29
  cd ..
30
  else
@@ -39,11 +31,7 @@ else
39
  fi
40
 
41
  cd stable-diffusion
42
- git checkout f6cfebffa752ee11a7b07497b8529d5971de916c
43
-
44
- git apply ../ui/sd_internal/ddim_callback.patch
45
- git apply ../ui/sd_internal/env_yaml.patch
46
-
47
  cd ..
48
  fi
49
 
@@ -70,14 +58,6 @@ else
70
 
71
  conda activate ./env
72
 
73
- if conda install -c conda-forge --prefix ./env -y antlr4-python3-runtime=4.8 ; then
74
- echo "Installed. Testing.."
75
- else
76
- printf "\n\nError installing antlr4-python3-runtime for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
77
- read -p "Press any key to continue"
78
- exit
79
- fi
80
-
81
  out_test=`python -c "import torch; import ldm; import transformers; import numpy; import antlr4; print(42)"`
82
  if [ "$out_test" != "42" ]; then
83
  printf "\n\nDependency test failed! Error installing the packages necessary for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@@ -164,11 +144,8 @@ fi
164
 
165
 
166
 
167
- mkdir -p "../models/stable-diffusion"
168
- echo "" > "../models/stable-diffusion/Put your custom ckpt files here.txt"
169
-
170
  if [ -f "sd-v1-4.ckpt" ]; then
171
- model_size=`find "sd-v1-4.ckpt" -printf "%s"`
172
 
173
  if [ "$model_size" -eq "4265380512" ] || [ "$model_size" -eq "7703807346" ] || [ "$model_size" -eq "7703810927" ]; then
174
  echo "Data files (weights) necessary for Stable Diffusion were already downloaded"
@@ -184,7 +161,7 @@ if [ ! -f "sd-v1-4.ckpt" ]; then
184
  curl -L -k https://me.cmdr2.org/stable-diffusion-ui/sd-v1-4.ckpt > sd-v1-4.ckpt
185
 
186
  if [ -f "sd-v1-4.ckpt" ]; then
187
- model_size=`find "sd-v1-4.ckpt" -printf "%s"`
188
  if [ ! "$model_size" == "4265380512" ]; then
189
  printf "\n\nError: The downloaded model file was invalid! Bytes downloaded: $model_size\n\n"
190
  printf "\n\nError downloading the data files (weights) for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@@ -200,7 +177,7 @@ fi
200
 
201
 
202
  if [ -f "GFPGANv1.3.pth" ]; then
203
- model_size=`find "GFPGANv1.3.pth" -printf "%s"`
204
 
205
  if [ "$model_size" -eq "348632874" ]; then
206
  echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded"
@@ -216,7 +193,7 @@ if [ ! -f "GFPGANv1.3.pth" ]; then
216
  curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > GFPGANv1.3.pth
217
 
218
  if [ -f "GFPGANv1.3.pth" ]; then
219
- model_size=`find "GFPGANv1.3.pth" -printf "%s"`
220
  if [ ! "$model_size" -eq "348632874" ]; then
221
  printf "\n\nError: The downloaded GFPGAN model file was invalid! Bytes downloaded: $model_size\n\n"
222
  printf "\n\nError downloading the data files (weights) for GFPGAN (Face Correction). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@@ -232,7 +209,7 @@ fi
232
 
233
 
234
  if [ -f "RealESRGAN_x4plus.pth" ]; then
235
- model_size=`find "RealESRGAN_x4plus.pth" -printf "%s"`
236
 
237
  if [ "$model_size" -eq "67040989" ]; then
238
  echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded"
@@ -248,7 +225,7 @@ if [ ! -f "RealESRGAN_x4plus.pth" ]; then
248
  curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > RealESRGAN_x4plus.pth
249
 
250
  if [ -f "RealESRGAN_x4plus.pth" ]; then
251
- model_size=`find "RealESRGAN_x4plus.pth" -printf "%s"`
252
  if [ ! "$model_size" -eq "67040989" ]; then
253
  printf "\n\nError: The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: $model_size\n\n"
254
  printf "\n\nError downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@@ -264,7 +241,7 @@ fi
264
 
265
 
266
  if [ -f "RealESRGAN_x4plus_anime_6B.pth" ]; then
267
- model_size=`find "RealESRGAN_x4plus_anime_6B.pth" -printf "%s"`
268
 
269
  if [ "$model_size" -eq "17938799" ]; then
270
  echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded"
@@ -280,7 +257,7 @@ if [ ! -f "RealESRGAN_x4plus_anime_6B.pth" ]; then
280
  curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > RealESRGAN_x4plus_anime_6B.pth
281
 
282
  if [ -f "RealESRGAN_x4plus_anime_6B.pth" ]; then
283
- model_size=`find "RealESRGAN_x4plus_anime_6B.pth" -printf "%s"`
284
  if [ ! "$model_size" -eq "17938799" ]; then
285
  printf "\n\nError: The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: $model_size\n\n"
286
  printf "\n\nError downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@@ -310,8 +287,6 @@ cd ..
310
  export SD_UI_PATH=`pwd`/ui
311
  cd stable-diffusion
312
 
313
- python --version
314
-
315
  uvicorn server:app --app-dir "$SD_UI_PATH" --port 9000 --host 0.0.0.0
316
 
317
  read -p "Press any key to continue"
 
4
 
5
  source installer/etc/profile.d/conda.sh
6
 
7
+ python -c "import os; import shutil; frm = 'sd-ui-files/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'; dst = os.path.join(os.path.expanduser('~'), '.cache', 'huggingface', 'transformers', '9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'); shutil.copyfile(frm, dst); print('Hotfixed broken JSON file from OpenAI');"
 
 
 
 
 
8
 
9
  # Caution, this file will make your eyes and brain bleed. It's such an unholy mess.
10
  # Note to self: Please rewrite this in Python. For the sake of your own sanity.
 
16
 
17
  git reset --hard
18
  git pull
19
+ git checkout d154155d4c0b43e13ec1f00eb72b7ff9d522fcf9
 
 
 
20
 
21
  cd ..
22
  else
 
31
  fi
32
 
33
  cd stable-diffusion
34
+ git checkout d154155d4c0b43e13ec1f00eb72b7ff9d522fcf9
 
 
 
 
35
  cd ..
36
  fi
37
 
 
58
 
59
  conda activate ./env
60
 
 
 
 
 
 
 
 
 
61
  out_test=`python -c "import torch; import ldm; import transformers; import numpy; import antlr4; print(42)"`
62
  if [ "$out_test" != "42" ]; then
63
  printf "\n\nDependency test failed! Error installing the packages necessary for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
 
144
 
145
 
146
 
 
 
 
147
  if [ -f "sd-v1-4.ckpt" ]; then
148
+ model_size=`ls -l sd-v1-4.ckpt | awk '{print $5}'`
149
 
150
  if [ "$model_size" -eq "4265380512" ] || [ "$model_size" -eq "7703807346" ] || [ "$model_size" -eq "7703810927" ]; then
151
  echo "Data files (weights) necessary for Stable Diffusion were already downloaded"
 
161
  curl -L -k https://me.cmdr2.org/stable-diffusion-ui/sd-v1-4.ckpt > sd-v1-4.ckpt
162
 
163
  if [ -f "sd-v1-4.ckpt" ]; then
164
+ model_size=`ls -l sd-v1-4.ckpt | awk '{print $5}'`
165
  if [ ! "$model_size" == "4265380512" ]; then
166
  printf "\n\nError: The downloaded model file was invalid! Bytes downloaded: $model_size\n\n"
167
  printf "\n\nError downloading the data files (weights) for Stable Diffusion. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
 
177
 
178
 
179
  if [ -f "GFPGANv1.3.pth" ]; then
180
+ model_size=`ls -l GFPGANv1.3.pth | awk '{print $5}'`
181
 
182
  if [ "$model_size" -eq "348632874" ]; then
183
  echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded"
 
193
  curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > GFPGANv1.3.pth
194
 
195
  if [ -f "GFPGANv1.3.pth" ]; then
196
+ model_size=`ls -l GFPGANv1.3.pth | awk '{print $5}'`
197
  if [ ! "$model_size" -eq "348632874" ]; then
198
  printf "\n\nError: The downloaded GFPGAN model file was invalid! Bytes downloaded: $model_size\n\n"
199
  printf "\n\nError downloading the data files (weights) for GFPGAN (Face Correction). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
 
209
 
210
 
211
  if [ -f "RealESRGAN_x4plus.pth" ]; then
212
+ model_size=`ls -l RealESRGAN_x4plus.pth | awk '{print $5}'`
213
 
214
  if [ "$model_size" -eq "67040989" ]; then
215
  echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded"
 
225
  curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > RealESRGAN_x4plus.pth
226
 
227
  if [ -f "RealESRGAN_x4plus.pth" ]; then
228
+ model_size=`ls -l RealESRGAN_x4plus.pth | awk '{print $5}'`
229
  if [ ! "$model_size" -eq "67040989" ]; then
230
  printf "\n\nError: The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: $model_size\n\n"
231
  printf "\n\nError downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
 
241
 
242
 
243
  if [ -f "RealESRGAN_x4plus_anime_6B.pth" ]; then
244
+ model_size=`ls -l RealESRGAN_x4plus_anime_6B.pth | awk '{print $5}'`
245
 
246
  if [ "$model_size" -eq "17938799" ]; then
247
  echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded"
 
257
  curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > RealESRGAN_x4plus_anime_6B.pth
258
 
259
  if [ -f "RealESRGAN_x4plus_anime_6B.pth" ]; then
260
+ model_size=`ls -l RealESRGAN_x4plus_anime_6B.pth | awk '{print $5}'`
261
  if [ ! "$model_size" -eq "17938799" ]; then
262
  printf "\n\nError: The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: $model_size\n\n"
263
  printf "\n\nError downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
 
287
  export SD_UI_PATH=`pwd`/ui
288
  cd stable-diffusion
289
 
 
 
290
  uvicorn server:app --app-dir "$SD_UI_PATH" --port 9000 --host 0.0.0.0
291
 
292
  read -p "Press any key to continue"
{ui/scripts → config}/post_activate.bat RENAMED
File without changes
{ui/scripts → config}/post_activate.sh RENAMED
File without changes
{ui/scripts → config}/start.sh RENAMED
@@ -4,7 +4,4 @@ source installer/bin/activate
4
 
5
  conda-unpack
6
 
7
- conda --version
8
- git --version
9
-
10
  scripts/on_env_start.sh
 
4
 
5
  conda-unpack
6
 
 
 
 
7
  scripts/on_env_start.sh
{ui/scripts → config}/win_enable_long_filepaths.ps1 RENAMED
File without changes
modules/app.py CHANGED
@@ -10,8 +10,8 @@ print('started in ', SD_DIR)
10
  SD_UI_DIR = './ui'
11
  sys.path.append(os.path.dirname(SD_UI_DIR))
12
 
13
- CONFIG_DIR = os.path.abspath(os.path.join(SD_UI_DIR, '..', 'scripts'))
14
- MODELS_DIR = os.path.abspath(os.path.join(SD_DIR, '..', 'models'))
15
 
16
  OUTPUT_DIRNAME = "Stable Diffusion UI" # in the user's home folder
17
 
 
10
  SD_UI_DIR = './ui'
11
  sys.path.append(os.path.dirname(SD_UI_DIR))
12
 
13
+ CONFIG_DIR = os.path.abspath(os.path.join(SD_UI_DIR, '.', 'config'))
14
+ MODELS_DIR = os.path.abspath(os.path.join(SD_DIR, '.', 'models'))
15
 
16
  OUTPUT_DIRNAME = "Stable Diffusion UI" # in the user's home folder
17
 
ui/scripts/Developer Console.cmd DELETED
@@ -1,14 +0,0 @@
1
- @echo off
2
-
3
- echo "Opening Stable Diffusion UI - Developer Console.." & echo.
4
-
5
- @call installer\Scripts\activate.bat
6
-
7
- @call conda-unpack
8
-
9
- @call conda --version
10
- @call git --version
11
-
12
- @call conda activate .\stable-diffusion\env
13
-
14
- cmd /k
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/scripts/Start Stable Diffusion UI.cmd DELETED
@@ -1,19 +0,0 @@
1
- @echo off
2
-
3
- @REM Delete the post-activate hook from the old installer
4
- if exist "installer\etc\conda\activate.d\post_activate.bat" (
5
- echo. > installer\etc\conda\activate.d\post_activate.bat
6
- )
7
-
8
- @call installer\Scripts\activate.bat
9
-
10
- @call conda-unpack
11
-
12
- @call conda --version
13
- @call git --version
14
-
15
- @cd installer
16
-
17
- @call ..\scripts\on_env_start.bat
18
-
19
- @pause
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/scripts/developer_console.sh DELETED
@@ -1,17 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [ "$0" == "bash" ]; then
4
- echo "Opening Stable Diffusion UI - Developer Console.."
5
- echo ""
6
-
7
- source installer/bin/activate
8
-
9
- conda-unpack
10
-
11
- conda --version
12
- git --version
13
-
14
- conda activate ./stable-diffusion/env
15
- else
16
- bash --init-file developer_console.sh
17
- fi