stlaurentjr commited on
Commit
274b0c3
1 Parent(s): 6ee2ce6

Update scripts/mainrunpodA1111.py

Browse files
Files changed (1) hide show
  1. scripts/mainrunpodA1111.py +44 -42
scripts/mainrunpodA1111.py CHANGED
@@ -23,51 +23,53 @@ import zipfile
23
 
24
  def Deps(force_reinstall):
25
  # Определяем путь к файлу-маркеру
26
- marker_file = '/workspace/setup_complete'
27
- if not force_reinstall and os.path.exists(marker_file):
28
- ntbks()
29
- print('Modules and notebooks updated, dependencies already installed')
30
- os.environ['TORCH_HOME'] = '/workspace/cache/torch'
31
- os.environ['PYTHONWARNINGS'] = 'ignore'
32
- call("pip install controlnet_aux --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
33
- call("pip install diskcache --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
34
- call("pip install pillow-avif-plugin --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
35
- call('pip install --root-user-action=ignore --disable-pip-version-check -qq gradio==3.41.2', shell=True, stdout=open('/dev/null', 'w'))
36
- call("pip install pyre-extensions==0.0.29 --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
37
- clear_output()
38
- done()
39
- else:
40
- call('pip install --root-user-action=ignore --disable-pip-version-check --no-deps -qq gdown PyWavelets numpy==1.23.5 accelerate==0.12.0 --force-reinstall', shell=True, stdout=open('/dev/null', 'w'))
41
- ntbks()
42
- if os.path.exists('deps'):
43
- call("rm -r deps", shell=True)
44
- if os.path.exists('diffusers'):
45
- call("rm -r diffusers", shell=True)
46
  call('mkdir deps', shell=True)
47
- if not os.path.exists('cache'):
48
- call('mkdir cache', shell=True)
49
  os.chdir('deps')
50
  dwn("https://huggingface.co/spaces/stlaurentjr/RNPD/resolve/main/deps/rnpddeps-t2.tar.zst", "/workspace/deps/rnpddeps-t2.tar.zst", "Installing dependencies")
51
- call('tar -C / --zstd -xf rnpddeps-t2.tar.zst', shell=True, stdout=open('/dev/null', 'w'))
52
- call("sed -i 's@~/.cache@/workspace/cache@' /usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py", shell=True)
53
- os.chdir('/workspace')
54
- call("pip install pyre-extensions==0.0.29 --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
55
- call("pip install controlnet_aux --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
56
- call("pip install diskcache --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
57
- call("pip install pillow-avif-plugin --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
58
- call("git clone --depth 1 -q --branch main https://github.com/TheLastBen/diffusers", shell=True, stdout=open('/dev/null', 'w'))
59
- call('pip install --root-user-action=ignore --disable-pip-version-check -qq gradio==3.41.2', shell=True, stdout=open('/dev/null', 'w'))
60
- call("rm -r deps", shell=True)
61
- os.chdir('/workspace')
62
- os.environ['TORCH_HOME'] = '/workspace/cache/torch'
63
- os.environ['PYTHONWARNINGS'] = 'ignore'
64
- call("sed -i 's@text = _formatwarnmsg(msg)@text =\"\"@g' /usr/lib/python3.10/warnings.py", shell=True)
65
- # Создаём файл-маркер после успешного выполнения установок
66
- with open(marker_file, 'w') as f:
67
- f.write('Setup complete')
68
-
69
- clear_output()
70
- done()
 
 
 
 
71
 
72
 
73
 
 
23
 
24
  def Deps(force_reinstall):
25
  # Определяем путь к файлу-маркеру
26
+ #marker_file = '/workspace/setup_complete'
27
+ # if not force_reinstall and os.path.exists(marker_file):
28
+ # ntbks()
29
+ # print('Modules and notebooks updated, dependencies already installed')
30
+ # os.environ['TORCH_HOME'] = '/workspace/cache/torch'
31
+ # os.environ['PYTHONWARNINGS'] = 'ignore'
32
+ # call("pip install controlnet_aux --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
33
+ # call("pip install diskcache --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
34
+ # call("pip install pillow-avif-plugin --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
35
+ # call('pip install --root-user-action=ignore --disable-pip-version-check -qq gradio==3.41.2', shell=True, stdout=open('/dev/null', 'w'))
36
+ # call("pip install pyre-extensions==0.0.29 --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
37
+ # clear_output()
38
+ # done()
39
+ # else:
40
+ call('pip install --root-user-action=ignore --disable-pip-version-check --no-deps -qq gdown PyWavelets numpy==1.23.5 accelerate==0.12.0 --force-reinstall', shell=True, stdout=open('/dev/null', 'w'))
41
+ if os.path.exists('deps'):
42
+ call("rm -r deps", shell=True)
43
+ if os.path.exists('diffusers'):
44
+ call("rm -r diffusers", shell=True)
45
+ if not os.path.exists('deps'):
46
  call('mkdir deps', shell=True)
 
 
47
  os.chdir('deps')
48
  dwn("https://huggingface.co/spaces/stlaurentjr/RNPD/resolve/main/deps/rnpddeps-t2.tar.zst", "/workspace/deps/rnpddeps-t2.tar.zst", "Installing dependencies")
49
+ if not os.path.exists('cache'):
50
+ call('mkdir cache', shell=True)
51
+ os.chdir('deps')
52
+
53
+ call('tar -C / --zstd -xf rnpddeps-t2.tar.zst', shell=True, stdout=open('/dev/null', 'w'))
54
+ call("sed -i 's@~/.cache@/workspace/cache@' /usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py", shell=True)
55
+ os.chdir('/workspace')
56
+ call("pip install pyre-extensions==0.0.29 --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
57
+ call("pip install controlnet_aux --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
58
+ call("pip install diskcache --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
59
+ call("pip install pillow-avif-plugin --root-user-action=ignore --disable-pip-version-check", shell=True, stdout=open('/dev/null', 'w'))
60
+ call("git clone --depth 1 -q --branch main https://github.com/TheLastBen/diffusers", shell=True, stdout=open('/dev/null', 'w'))
61
+ call('pip install --root-user-action=ignore --disable-pip-version-check -qq gradio==3.41.2', shell=True, stdout=open('/dev/null', 'w'))
62
+ call("rm -r deps", shell=True)
63
+ os.chdir('/workspace')
64
+ os.environ['TORCH_HOME'] = '/workspace/cache/torch'
65
+ os.environ['PYTHONWARNINGS'] = 'ignore'
66
+ call("sed -i 's@text = _formatwarnmsg(msg)@text =\"\"@g' /usr/lib/python3.10/warnings.py", shell=True)
67
+ # Создаём файл-маркер после успешного выполнения установок
68
+ #with open(marker_file, 'w') as f:
69
+ # f.write('Setup complete')
70
+
71
+ clear_output()
72
+ done()
73
 
74
 
75