Spaces:
Running
on
Zero
Running
on
Zero
IceClear
commited on
Commit
·
367bee6
1
Parent(s):
aebdeba
update prebuild
Browse files
app.py
CHANGED
@@ -60,6 +60,8 @@ import gradio as gr
|
|
60 |
from pathlib import Path
|
61 |
from urllib.parse import urlparse
|
62 |
from torch.hub import download_url_to_file, get_dir
|
|
|
|
|
63 |
|
64 |
subprocess.run(
|
65 |
"pip install flash-attn --no-build-isolation",
|
@@ -67,15 +69,6 @@ subprocess.run(
|
|
67 |
shell=True,
|
68 |
)
|
69 |
|
70 |
-
|
71 |
-
result = subprocess.run(
|
72 |
-
["bash", "setup.sh"],
|
73 |
-
capture_output=True,
|
74 |
-
text=True,
|
75 |
-
check=True
|
76 |
-
)
|
77 |
-
print(f"✅ setup completed:\n{result.stdout}")
|
78 |
-
|
79 |
def load_file_from_url(url, model_dir=None, progress=True, file_name=None):
|
80 |
"""Load file form http url, will download models if necessary.
|
81 |
|
@@ -117,7 +110,8 @@ pretrain_model_url = {
|
|
117 |
'vae': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/ema_vae.pth',
|
118 |
'dit': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/seedvr2_ema_3b.pth',
|
119 |
'pos_emb': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/pos_emb.pt',
|
120 |
-
'neg_emb': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/neg_emb.pt'
|
|
|
121 |
}
|
122 |
# download weights
|
123 |
if not os.path.exists('./ckpts/seedvr2_ema_3b.pth'):
|
@@ -128,6 +122,11 @@ if not os.path.exists('./pos_emb.pt'):
|
|
128 |
load_file_from_url(url=pretrain_model_url['pos_emb'], model_dir='./', progress=True, file_name=None)
|
129 |
if not os.path.exists('./neg_emb.pt'):
|
130 |
load_file_from_url(url=pretrain_model_url['neg_emb'], model_dir='./', progress=True, file_name=None)
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
# download images
|
133 |
torch.hub.download_url_to_file(
|
|
|
60 |
from pathlib import Path
|
61 |
from urllib.parse import urlparse
|
62 |
from torch.hub import download_url_to_file, get_dir
|
63 |
+
import shlex
|
64 |
+
|
65 |
|
66 |
subprocess.run(
|
67 |
"pip install flash-attn --no-build-isolation",
|
|
|
69 |
shell=True,
|
70 |
)
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
def load_file_from_url(url, model_dir=None, progress=True, file_name=None):
|
73 |
"""Load file form http url, will download models if necessary.
|
74 |
|
|
|
110 |
'vae': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/ema_vae.pth',
|
111 |
'dit': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/seedvr2_ema_3b.pth',
|
112 |
'pos_emb': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/pos_emb.pt',
|
113 |
+
'neg_emb': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/neg_emb.pt',
|
114 |
+
'apex': 'https://huggingface.co/ByteDance-Seed/SeedVR2-3B/resolve/main/apex-0.1-cp39-cp39-linux_x86_64.whl'
|
115 |
}
|
116 |
# download weights
|
117 |
if not os.path.exists('./ckpts/seedvr2_ema_3b.pth'):
|
|
|
122 |
load_file_from_url(url=pretrain_model_url['pos_emb'], model_dir='./', progress=True, file_name=None)
|
123 |
if not os.path.exists('./neg_emb.pt'):
|
124 |
load_file_from_url(url=pretrain_model_url['neg_emb'], model_dir='./', progress=True, file_name=None)
|
125 |
+
if not os.path.exists('./apex-0.1-cp39-cp39-linux_x86_64.whl'):
|
126 |
+
load_file_from_url(url=pretrain_model_url['apex'], model_dir='./', progress=True, file_name=None)
|
127 |
+
|
128 |
+
subprocess.run(shlex.split("pip install apex-0.1-cp39-cp39-linux_x86_64.whl"))
|
129 |
+
print(f"✅ setup completed Apex")
|
130 |
|
131 |
# download images
|
132 |
torch.hub.download_url_to_file(
|
setup.sh
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
pip install --upgrade pip setuptools wheel
|
3 |
-
|
4 |
-
git clone https://github.com/NVIDIA/apex
|
5 |
-
cd apex
|
6 |
-
# if pip >= 23.1 (ref: https://pip.pypa.io/en/stable/news/#v23-1) which supports multiple `--config-settings` with the same key...
|
7 |
-
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
|
8 |
-
cd ..
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|