Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import subprocess
|
2 |
|
|
|
3 |
subprocess.run(
|
4 |
'pip install flash-attn --no-build-isolation',
|
5 |
env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"},
|
6 |
shell=True
|
7 |
)
|
8 |
-
subprocess.run('pip install googletrans==4.0.0-rc1', shell=True)
|
9 |
|
10 |
import os
|
11 |
import re
|
@@ -23,7 +24,7 @@ from transformers import (
|
|
23 |
)
|
24 |
|
25 |
# Configuration Constants
|
26 |
-
MODEL_ID = "CohereForAI/aya-expanse-
|
27 |
DEFAULT_SYSTEM_PROMPT = """
|
28 |
You are a bilingual translator specializing in Arabic and English translations. Your objective is to create precise, contextually appropriate, and stylistically consistent translations that adhere to the following guidelines:
|
29 |
|
@@ -146,7 +147,7 @@ def initialize_model():
|
|
146 |
torch_dtype=torch.float16,
|
147 |
device_map="cuda",
|
148 |
attn_implementation="flash_attention_2",
|
149 |
-
quantization_config=quantization_config
|
150 |
|
151 |
)
|
152 |
|
|
|
1 |
import subprocess
|
2 |
|
3 |
+
# Install required dependencies
|
4 |
subprocess.run(
|
5 |
'pip install flash-attn --no-build-isolation',
|
6 |
env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"},
|
7 |
shell=True
|
8 |
)
|
9 |
+
subprocess.run('pip install googletrans==4.0.0-rc1 httpx>=0.24.1 gradio>=5.9.1 gradio-client>=1.5.2', shell=True)
|
10 |
|
11 |
import os
|
12 |
import re
|
|
|
24 |
)
|
25 |
|
26 |
# Configuration Constants
|
27 |
+
MODEL_ID = "CohereForAI/aya-expanse-8b"
|
28 |
DEFAULT_SYSTEM_PROMPT = """
|
29 |
You are a bilingual translator specializing in Arabic and English translations. Your objective is to create precise, contextually appropriate, and stylistically consistent translations that adhere to the following guidelines:
|
30 |
|
|
|
147 |
torch_dtype=torch.float16,
|
148 |
device_map="cuda",
|
149 |
attn_implementation="flash_attention_2",
|
150 |
+
#quantization_config=quantization_config
|
151 |
|
152 |
)
|
153 |
|