Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,23 @@ from transformers import T5ForConditionalGeneration, T5Tokenizer
|
|
10 |
import os
|
11 |
|
12 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
|
17 |
def download_t5_model(model_id, save_directory):
|
|
|
10 |
import os
|
11 |
|
12 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
13 |
+
|
14 |
+
|
15 |
+
def install_apex():
|
16 |
+
cmd = [
|
17 |
+
"pip", "install", "-v", "--disable-pip-version-check", "--no-cache-dir",
|
18 |
+
"--no-build-isolation", "--config-settings", "--build-option=--cpp_ext",
|
19 |
+
"--config-settings", "--build-option=--cuda_ext",
|
20 |
+
"git+https://github.com/NVIDIA/apex.git"
|
21 |
+
]
|
22 |
+
subprocess.run(cmd, check=True)
|
23 |
+
|
24 |
+
try:
|
25 |
+
import apex
|
26 |
+
except ImportError:
|
27 |
+
print("apex not installed, installing now...")
|
28 |
+
install_apex()
|
29 |
+
import apex # Try to import again after installation
|
30 |
|
31 |
|
32 |
def download_t5_model(model_id, save_directory):
|