Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,22 +15,10 @@ 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 |
-
'--global-option="--cpp_ext"','--global-option="--cuda_ext"',
|
| 19 |
'--config-settings', '--build-option=--cuda_ext', 'git+https://github.com/NVIDIA/apex.git'
|
| 20 |
]
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
except subprocess.CalledProcessError as e:
|
| 24 |
-
print(f"Apex installation failed: {e}")
|
| 25 |
-
raise
|
| 26 |
-
|
| 27 |
-
try:
|
| 28 |
-
import apex
|
| 29 |
-
except ModuleNotFoundError:
|
| 30 |
-
print("Apex not found, installing...")
|
| 31 |
-
install_apex()
|
| 32 |
-
import apex # Try to import again after installing
|
| 33 |
-
|
| 34 |
def download_t5_model(model_id, save_directory):
|
| 35 |
# Modelin tokenizer'ını ve modeli indir
|
| 36 |
model = T5ForConditionalGeneration.from_pretrained(model_id)
|
|
|
|
| 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 |
+
subprocess.run(cmd, check=True)
|
| 21 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
def download_t5_model(model_id, save_directory):
|
| 23 |
# Modelin tokenizer'ını ve modeli indir
|
| 24 |
model = T5ForConditionalGeneration.from_pretrained(model_id)
|