Spaces:
Running
Running
Guy Mor-Lan
commited on
Commit
•
e10ff47
1
Parent(s):
e35836c
pull model files
Browse files- ar_en +0 -1
- en_ar +0 -1
- translate.py +5 -5
ar_en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit b5626c21d9814e83302354362e60d813003f8b97
|
|
|
|
en_ar
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 76d2a612d5c6b4cc8fe16bd7608e7a0809a96ba5
|
|
|
|
translate.py
CHANGED
@@ -13,13 +13,13 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag
|
|
13 |
file_handler.setFormatter(formatter)
|
14 |
logger.addHandler(file_handler)
|
15 |
|
16 |
-
model_to_ar = MarianMTModel.from_pretrained("
|
17 |
-
model_from_ar = MarianMTModel.from_pretrained("
|
18 |
model_to_ar_ct2 = ctranslate2.Translator("./en_ar_ct2/")
|
19 |
model_from_ar_ct2 = ctranslate2.Translator("./ar_en_ct2/")
|
20 |
|
21 |
-
tokenizer_to_ar = AutoTokenizer.from_pretrained("
|
22 |
-
tokenizer_from_ar = AutoTokenizer.from_pretrained("
|
23 |
print("Done loading models")
|
24 |
|
25 |
dialect_map = {
|
@@ -98,4 +98,4 @@ def run_translate(text, dialect=None):
|
|
98 |
|
99 |
text = f"{dialect} {text}" if dialect else text
|
100 |
return translate(text, model_to_ar_ct2, model_to_ar, tokenizer_to_ar,
|
101 |
-
to_arabic=True, threshold=None, layer=2, head=7)
|
|
|
13 |
file_handler.setFormatter(formatter)
|
14 |
logger.addHandler(file_handler)
|
15 |
|
16 |
+
model_to_ar = MarianMTModel.from_pretrained("guymorlan/levanti_translate_en_ar", output_attentions=True)
|
17 |
+
model_from_ar = MarianMTModel.from_pretrained("guymorlan/levanti_translate_ar_en", output_attentions=True)
|
18 |
model_to_ar_ct2 = ctranslate2.Translator("./en_ar_ct2/")
|
19 |
model_from_ar_ct2 = ctranslate2.Translator("./ar_en_ct2/")
|
20 |
|
21 |
+
tokenizer_to_ar = AutoTokenizer.from_pretrained("guymorlan/levanti_translate_en_ar")
|
22 |
+
tokenizer_from_ar = AutoTokenizer.from_pretrained("guymorlan/levanti_translate_ar_en")
|
23 |
print("Done loading models")
|
24 |
|
25 |
dialect_map = {
|
|
|
98 |
|
99 |
text = f"{dialect} {text}" if dialect else text
|
100 |
return translate(text, model_to_ar_ct2, model_to_ar, tokenizer_to_ar,
|
101 |
+
to_arabic=True, threshold=None, layer=2, head=7)
|