Spaces:
Sleeping
Sleeping
Remove LlamaX
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ models = ["Helsinki-NLP",
|
|
| 31 |
"google/flan-t5-small", "google/flan-t5-base", "google/flan-t5-large", "google/flan-t5-xl",
|
| 32 |
"google/madlad400-3b-mt", "jbochi/madlad400-3b-mt",
|
| 33 |
"Argos", "Google",
|
| 34 |
-
"HuggingFaceTB/SmolLM3-3B", "winninghealth/WiNGPT-Babel-2",
|
| 35 |
"utter-project/EuroLLM-1.7B", "utter-project/EuroLLM-1.7B-Instruct",
|
| 36 |
"Unbabel/Tower-Plus-2B", "Unbabel/TowerInstruct-7B-v0.2", "Unbabel/TowerInstruct-Mistral-7B-v0.2",
|
| 37 |
"openGPT-X/Teuken-7B-instruct-commercial-v0.4", "openGPT-X/Teuken-7B-instruct-v0.6"
|
|
@@ -130,14 +130,7 @@ class Translators:
|
|
| 130 |
return self.HelsinkiNLP_mulroa()
|
| 131 |
except KeyError as error:
|
| 132 |
return f"Error: Translation direction {self.sl} to {self.tl} is not supported by Helsinki Translation Models", error
|
| 133 |
-
|
| 134 |
-
def LLaMAX(self):
|
| 135 |
-
pipe = pipeline("text-generation", model="LLaMAX/LLaMAX3-8B")
|
| 136 |
-
messages = [
|
| 137 |
-
{"role": "user", "content": f"Translate the following text from {self.sl} to {self.sl}: {self.input_text}"},
|
| 138 |
-
]
|
| 139 |
-
return pipe(messages)[0]["generated_text"]
|
| 140 |
-
|
| 141 |
def LegoMT(self):
|
| 142 |
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
|
| 143 |
model = M2M100ForConditionalGeneration.from_pretrained(self.model_name) # "Lego-MT/Lego-MT"
|
|
@@ -480,9 +473,6 @@ def translate_text(input_text: str, s_language: str, t_language: str, model_name
|
|
| 480 |
elif model_name == "winninghealth/WiNGPT-Babel-2":
|
| 481 |
translated_text = Translators(model_name, s_language, t_language, input_text).wingpt()
|
| 482 |
|
| 483 |
-
elif "LLaMAX" in model_name:
|
| 484 |
-
translated_text = Translators(model_name, s_language, t_language, input_text).LLaMAX()
|
| 485 |
-
|
| 486 |
elif model_name == "Bergamot":
|
| 487 |
translated_text, message_text = Translators(model_name, s_language, t_language, input_text).bergamot()
|
| 488 |
|
|
|
|
| 31 |
"google/flan-t5-small", "google/flan-t5-base", "google/flan-t5-large", "google/flan-t5-xl",
|
| 32 |
"google/madlad400-3b-mt", "jbochi/madlad400-3b-mt",
|
| 33 |
"Argos", "Google",
|
| 34 |
+
"HuggingFaceTB/SmolLM3-3B", "winninghealth/WiNGPT-Babel-2",
|
| 35 |
"utter-project/EuroLLM-1.7B", "utter-project/EuroLLM-1.7B-Instruct",
|
| 36 |
"Unbabel/Tower-Plus-2B", "Unbabel/TowerInstruct-7B-v0.2", "Unbabel/TowerInstruct-Mistral-7B-v0.2",
|
| 37 |
"openGPT-X/Teuken-7B-instruct-commercial-v0.4", "openGPT-X/Teuken-7B-instruct-v0.6"
|
|
|
|
| 130 |
return self.HelsinkiNLP_mulroa()
|
| 131 |
except KeyError as error:
|
| 132 |
return f"Error: Translation direction {self.sl} to {self.tl} is not supported by Helsinki Translation Models", error
|
| 133 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
def LegoMT(self):
|
| 135 |
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
|
| 136 |
model = M2M100ForConditionalGeneration.from_pretrained(self.model_name) # "Lego-MT/Lego-MT"
|
|
|
|
| 473 |
elif model_name == "winninghealth/WiNGPT-Babel-2":
|
| 474 |
translated_text = Translators(model_name, s_language, t_language, input_text).wingpt()
|
| 475 |
|
|
|
|
|
|
|
|
|
|
| 476 |
elif model_name == "Bergamot":
|
| 477 |
translated_text, message_text = Translators(model_name, s_language, t_language, input_text).bergamot()
|
| 478 |
|