Spaces:
Running
Running
stlaurentjr
commited on
Commit
•
683eb0e
1
Parent(s):
4babdb5
Update scripts/mainrunpodA1111.py
Browse files- scripts/mainrunpodA1111.py +42 -2
scripts/mainrunpodA1111.py
CHANGED
@@ -25,12 +25,52 @@ def Deps(force_reinstall):
|
|
25 |
import os
|
26 |
from subprocess import call
|
27 |
import venv
|
|
|
28 |
if not force_reinstall and os.path.exists('/usr/local/lib/python3.10/dist-packages/safetensors'):
|
|
|
|
|
|
|
|
|
29 |
ntbks()
|
30 |
print('[1;32mModules and notebooks updated, dependencies already installed')
|
31 |
os.environ['TORCH_HOME'] = '/workspace/cache/torch'
|
32 |
os.environ['PYTHONWARNINGS'] = 'ignore'
|
33 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
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'))
|
35 |
if os.path.exists('deps'):
|
36 |
call("rm -r deps", shell=True)
|
@@ -54,10 +94,10 @@ def Deps(force_reinstall):
|
|
54 |
|
55 |
# Проверка, что файл существует
|
56 |
if not os.path.exists("/workspace/deps/rnpddeps-t2.tar.zst"):
|
57 |
-
raise FileNotFoundError("The file /workspace/deps/
|
58 |
|
59 |
# Распаковка файла
|
60 |
-
call('tar -C / --zstd -xf /workspace/deps/
|
61 |
|
62 |
# Проверка наличия файла перед использованием sed
|
63 |
hub_py_path = "/usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py"
|
|
|
25 |
import os
|
26 |
from subprocess import call
|
27 |
import venv
|
28 |
+
|
29 |
if not force_reinstall and os.path.exists('/usr/local/lib/python3.10/dist-packages/safetensors'):
|
30 |
+
# Активация виртуального окружения и обновление pip
|
31 |
+
activate_script = os.path.join(venv_dir, 'bin', 'activate')
|
32 |
+
call(f'/bin/bash -c "source {activate_script} && pip install --upgrade pip"', shell=True)
|
33 |
+
|
34 |
ntbks()
|
35 |
print('[1;32mModules and notebooks updated, dependencies already installed')
|
36 |
os.environ['TORCH_HOME'] = '/workspace/cache/torch'
|
37 |
os.environ['PYTHONWARNINGS'] = 'ignore'
|
38 |
else:
|
39 |
+
|
40 |
+
# Активация виртуального окружения и установка зависимостей из файла requirements.txt
|
41 |
+
requirements = """
|
42 |
+
fastapi==0.87.0
|
43 |
+
onnxruntime==1.13.1
|
44 |
+
scipy==1.9.3
|
45 |
+
uvicorn==0.20.0
|
46 |
+
rembg==2.0.30
|
47 |
+
future
|
48 |
+
lmdb
|
49 |
+
google-auth<3,>=1.6.3
|
50 |
+
google-auth-oauthlib<0.5,>=0.4.1
|
51 |
+
grpcio>=1.24.3
|
52 |
+
markdown>=2.6.8
|
53 |
+
tensorboard-data-server<0.7.0,>=0.6.0
|
54 |
+
tensorboard-plugin-wit>=1.6.0
|
55 |
+
werkzeug>=1.0.1
|
56 |
+
requests==2.28.1
|
57 |
+
protobuf<4,>=3.20.2
|
58 |
+
gradio==3.41.2
|
59 |
+
gradio-client==0.5.0
|
60 |
+
huggingface-hub>=0.14.0
|
61 |
+
diskcache
|
62 |
+
pillow-avif-plugin
|
63 |
+
tomesd
|
64 |
+
pyre-extensions==0.0.29
|
65 |
+
"""
|
66 |
+
|
67 |
+
# Запись требований в файл requirements.txt
|
68 |
+
with open("/workspace/requirements.txt", "w") as req_file:
|
69 |
+
req_file.write(requirements)
|
70 |
+
|
71 |
+
# Установка зависимостей из requirements.txt
|
72 |
+
call(f'/bin/bash -c "source {activate_script} && pip install -r /workspace/requirements.txt"', shell=True)
|
73 |
+
|
74 |
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'))
|
75 |
if os.path.exists('deps'):
|
76 |
call("rm -r deps", shell=True)
|
|
|
94 |
|
95 |
# Проверка, что файл существует
|
96 |
if not os.path.exists("/workspace/deps/rnpddeps-t2.tar.zst"):
|
97 |
+
raise FileNotFoundError("The file /workspace/deps/rnpddeps-t2.tar.zst does not exist")
|
98 |
|
99 |
# Распаковка файла
|
100 |
+
call('tar -C / --zstd -xf /workspace/deps/rnpddeps-t2.tar.zst.zst', shell=True, stdout=open('/dev/null', 'w'))
|
101 |
|
102 |
# Проверка наличия файла перед использованием sed
|
103 |
hub_py_path = "/usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py"
|