forked from ARBML/Taqyim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtranslation.py
30 lines (27 loc) · 900 Bytes
/
translation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import taqyim as tq
def map_labels(sample):
if sample["label"] == "1":
sample["label"] = "Positive"
else:
sample["label"] = "Negative"
return sample
prompt = """
Translate the following statement from Arabic to Russian
""".strip()
pipeline = tq.Pipeline(
eval_name = "tatoeba-test",
dataset_name= "Helsinki-NLP/tatoeba_mt",
subset = "ara-rus",
task_class= "translation",
task_desc = "Translation from Russian to Arabic",
input_column_name = 'sourceString',
target_column_name = 'targetString',
prompt=prompt,
api_key='<openai-key>',
train_split="validation",
test_split="test",
model_name = "gpt-3.5-turbo-0301",
resume_from_record= True,
max_samples= 2,)
pipeline.run()
print(pipeline.show_results())