TheLastBen commited on
Commit
66e9b74
1 Parent(s): c8a4c27

Update Scripts/mainpaperspaceA1111.py

Browse files
Files changed (1) hide show
  1. Scripts/mainpaperspaceA1111.py +20 -27
Scripts/mainpaperspaceA1111.py CHANGED
@@ -10,16 +10,7 @@ import ipywidgets as widgets
10
  def Deps(force_reinstall):
11
 
12
  if not force_reinstall and os.path.exists('/usr/local/lib/python3.9/dist-packages/safetensors'):
13
- os.chdir('/notebooks')
14
- if not os.path.exists('Latest_Notebooks'):
15
- call('mkdir Latest_Notebooks', shell=True)
16
- else:
17
- call('rm -r Latest_Notebooks', shell=True)
18
- call('mkdir Latest_Notebooks', shell=True)
19
- os.chdir('/notebooks/Latest_Notebooks')
20
- call('wget -q -i https://huggingface.co/datasets/TheLastBen/PPS/raw/main/Notebooks.txt', shell=True)
21
- call('rm Notebooks.txt', shell=True)
22
- os.chdir('/notebooks')
23
  print('Modules and notebooks updated, dependencies already installed')
24
 
25
  else:
@@ -28,18 +19,7 @@ def Deps(force_reinstall):
28
  if not os.path.exists('/usr/local/lib/python3.9/dist-packages/safetensors'):
29
  os.chdir('/usr/local/lib/python3.9/dist-packages')
30
  call("rm -r torch torch-1.12.0+cu116.dist-info torchaudio* torchvision* PIL Pillow* transformers* numpy* gdown*", shell=True, stdout=open('/dev/null', 'w'))
31
-
32
- os.chdir('/notebooks')
33
- if not os.path.exists('Latest_Notebooks'):
34
- call('mkdir Latest_Notebooks', shell=True)
35
- else:
36
- call('rm -r Latest_Notebooks', shell=True)
37
- call('mkdir Latest_Notebooks', shell=True)
38
- os.chdir('/notebooks/Latest_Notebooks')
39
- call('wget -q -i https://huggingface.co/datasets/TheLastBen/PPS/raw/main/Notebooks.txt', shell=True)
40
- call('rm Notebooks.txt', shell=True)
41
- os.chdir('/notebooks')
42
-
43
  if not os.path.exists('/models'):
44
  call('mkdir /models', shell=True)
45
  if not os.path.exists('/notebooks/models'):
@@ -66,6 +46,20 @@ def Deps(force_reinstall):
66
  done()
67
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  def repo():
70
 
71
  print('Installing/Updating the repo...')
@@ -74,11 +68,11 @@ def repo():
74
  call('wget -q -O sd_rep.tar.zst https://huggingface.co/TheLastBen/dependencies/resolve/main/sd_rep.tar.zst', shell=True)
75
  call('tar --zstd -xf sd_rep.tar.zst', shell=True)
76
  call('rm sd_rep.tar.zst', shell=True)
77
-
78
  os.chdir('/notebooks/sd')
79
  if not os.path.exists('stable-diffusion-webui'):
80
  call('git clone -q --depth 1 --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui', shell=True)
81
-
82
  os.chdir('/notebooks/sd/stable-diffusion-webui/')
83
  call('git reset --hard', shell=True, stdout=open('/dev/null', 'w'))
84
  print('')
@@ -169,8 +163,7 @@ def sd(User, Password, Use_localtunnel):
169
  line = ''
170
  sys.stdout.write(line)
171
 
172
- call('rm /notebooks/srv.txt', shell=True)
173
- call('rm /notebooks/srvr.txt', shell=True)
174
 
175
  os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
176
  call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
@@ -178,7 +171,7 @@ def sd(User, Password, Use_localtunnel):
178
  os.chdir('/notebooks/sd/stable-diffusion-webui')
179
  clear_output()
180
 
181
- configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --xformers --enable-insecure-extension-access --medvram --skip-version-check "+auth+" "+share
182
 
183
  return configf
184
 
 
10
  def Deps(force_reinstall):
11
 
12
  if not force_reinstall and os.path.exists('/usr/local/lib/python3.9/dist-packages/safetensors'):
13
+ ntbk()
 
 
 
 
 
 
 
 
 
14
  print('Modules and notebooks updated, dependencies already installed')
15
 
16
  else:
 
19
  if not os.path.exists('/usr/local/lib/python3.9/dist-packages/safetensors'):
20
  os.chdir('/usr/local/lib/python3.9/dist-packages')
21
  call("rm -r torch torch-1.12.0+cu116.dist-info torchaudio* torchvision* PIL Pillow* transformers* numpy* gdown*", shell=True, stdout=open('/dev/null', 'w'))
22
+ ntbk()
 
 
 
 
 
 
 
 
 
 
 
23
  if not os.path.exists('/models'):
24
  call('mkdir /models', shell=True)
25
  if not os.path.exists('/notebooks/models'):
 
46
  done()
47
 
48
 
49
+ def ntbk():
50
+
51
+ os.chdir('/notebooks')
52
+ if not os.path.exists('Latest_Notebooks'):
53
+ call('mkdir Latest_Notebooks', shell=True)
54
+ else:
55
+ call('rm -r Latest_Notebooks', shell=True)
56
+ call('mkdir Latest_Notebooks', shell=True)
57
+ os.chdir('/notebooks/Latest_Notebooks')
58
+ call('wget -q -i https://huggingface.co/datasets/TheLastBen/PPS/raw/main/Notebooks.txt', shell=True)
59
+ call('rm Notebooks.txt', shell=True)
60
+ os.chdir('/notebooks')
61
+
62
+
63
  def repo():
64
 
65
  print('Installing/Updating the repo...')
 
68
  call('wget -q -O sd_rep.tar.zst https://huggingface.co/TheLastBen/dependencies/resolve/main/sd_rep.tar.zst', shell=True)
69
  call('tar --zstd -xf sd_rep.tar.zst', shell=True)
70
  call('rm sd_rep.tar.zst', shell=True)
71
+
72
  os.chdir('/notebooks/sd')
73
  if not os.path.exists('stable-diffusion-webui'):
74
  call('git clone -q --depth 1 --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui', shell=True)
75
+
76
  os.chdir('/notebooks/sd/stable-diffusion-webui/')
77
  call('git reset --hard', shell=True, stdout=open('/dev/null', 'w'))
78
  print('')
 
163
  line = ''
164
  sys.stdout.write(line)
165
 
166
+ call('rm srv.txt srvr.txt', shell=True))
 
167
 
168
  os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
169
  call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
 
171
  os.chdir('/notebooks/sd/stable-diffusion-webui')
172
  clear_output()
173
 
174
+ configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --xformers --enable-insecure-extension-access --skip-version-check "+auth+" "+share
175
 
176
  return configf
177