Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,22 +11,24 @@ 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_without_cuda():
|
16 |
cmd = [
|
17 |
'pip', 'install', '-v', '--disable-pip-version-check', '--no-cache-dir',
|
18 |
-
'
|
|
|
19 |
]
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
try:
|
23 |
import apex
|
24 |
except ModuleNotFoundError:
|
25 |
-
print("Apex not found, installing
|
26 |
-
|
27 |
-
#
|
28 |
-
import apex
|
29 |
-
"""
|
30 |
|
31 |
def download_t5_model(model_id, save_directory):
|
32 |
# Modelin tokenizer'ını ve modeli indir
|
|
|
11 |
|
12 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
13 |
|
14 |
+
def install_apex():
|
|
|
15 |
cmd = [
|
16 |
'pip', 'install', '-v', '--disable-pip-version-check', '--no-cache-dir',
|
17 |
+
'--no-build-isolation', '--config-settings', '--build-option=--cpp_ext',
|
18 |
+
'--config-settings', '--build-option=--cuda_ext', 'git+https://github.com/NVIDIA/apex.git'
|
19 |
]
|
20 |
+
try:
|
21 |
+
subprocess.run(cmd, check=True)
|
22 |
+
except subprocess.CalledProcessError as e:
|
23 |
+
print(f"Apex installation failed: {e}")
|
24 |
+
raise
|
25 |
|
26 |
try:
|
27 |
import apex
|
28 |
except ModuleNotFoundError:
|
29 |
+
print("Apex not found, installing...")
|
30 |
+
install_apex()
|
31 |
+
import apex # Try to import again after installing
|
|
|
|
|
32 |
|
33 |
def download_t5_model(model_id, save_directory):
|
34 |
# Modelin tokenizer'ını ve modeli indir
|