Update README.md (#3)
Browse files- Update README.md (11652cfbe4e5877349ae294b1c44b4b17446280e)
Co-authored-by: Raj Dabre <[email protected]>
README.md
CHANGED
@@ -19,14 +19,14 @@ model = AutoModelForSeq2SeqLM.from_pretrained("n8rob/kreyol-mt")
|
|
19 |
# Or use model = MBartForConditionalGeneration.from_pretrained("n8rob/kreyol-mt")
|
20 |
|
21 |
# First tokenize the input and outputs. The format below is how the model was trained so the input should be "Sentence </s> SRCCODE". Similarly, the output should be "TGTCODE Sentence </s>".
|
22 |
-
# For Hawaiian Creole to English translation, we need to use language indicator tags:
|
23 |
# For a mapping of the original language and language code (3 character) to mBART-50 compatible language tokens consider the following dictionary:
|
24 |
-
# {
|
25 |
# Note: We mapped languages to their language tokens manually. For example, we used en_XX, fr_XX, es_XX for English, French and Spanish as in the original mBART-50 model. But then we repurposed other tokens for Creoles.
|
26 |
|
27 |
# As for what the language codes and their corresponding languages are, please refer to: https://github.com/JHU-CLSP/Kreyol-MT?tab=readme-ov-file#building-machine-translation-for-latin-american-caribbean-and-colonial-african-creole-languages
|
28 |
|
29 |
-
inp = tokenizer('Wen dey wen stretch him out fo whip him real hard , Paul wen tell da captain dat stay dea , "Dis okay in da rules fo da Rome peopo ? fo you fo whip one guy dat get da same rights jalike da Rome peopo ? even one guy dat neva do notting wrong ?" </s>
|
30 |
|
31 |
model.eval() # Set dropouts to zero
|
32 |
|
|
|
19 |
# Or use model = MBartForConditionalGeneration.from_pretrained("n8rob/kreyol-mt")
|
20 |
|
21 |
# First tokenize the input and outputs. The format below is how the model was trained so the input should be "Sentence </s> SRCCODE". Similarly, the output should be "TGTCODE Sentence </s>".
|
22 |
+
# For Hawaiian Creole to English translation, we need to use language indicator tags: ko_KR and en_XX where ko_KR represents Hawaiian Creole (hwc) and en_XX represents English (eng).
|
23 |
# For a mapping of the original language and language code (3 character) to mBART-50 compatible language tokens consider the following dictionary:
|
24 |
+
# dictmap = {'acf': 'ar_AR', 'ara': 'cs_CZ', 'aze': 'it_IT', 'bzj': 'hi_IN', 'cab': 'az_AZ', 'ceb': 'et_EE', 'crs': 'fi_FI', 'deu': 'de_DE', 'djk': 'gu_IN', 'eng': 'en_XX', 'fra': 'fr_XX', 'gcf': 'ja_XX', 'gul': 'kk_KZ', 'hat': 'ko_KR', 'icr': 'lt_LT', 'jam': 'lv_LV', 'kea': 'my_MM', 'kri': 'ne_NP', 'ktu': 'nl_XX', 'mart1259': 'ro_RO', 'mfe': 'ru_RU', 'nep': 'si_LK', 'pap': 'tr_TR', 'pcm': 'vi_VN', 'por': 'pt_XX', 'sag': 'af_ZA', 'spa': 'es_XX', 'srm': 'bn_IN', 'srn': 'fa_IR', 'tpi': 'he_IL', 'zho': 'hr_HR', 'wes': 'zh_CN', 'trf': 'id_ID', 'svc': 'ka_GE', 'rcf': 'km_KH', 'pre': 'mk_MK', 'pov': 'ml_IN', 'mue': 'mn_MN', 'lou': 'mr_IN', 'gyn': 'pl_PL', 'gpe': 'ps_AF', 'gcr': 'sv_SE', 'fpe': 'sw_KE', 'fng': 'ta_IN', 'fab': 'te_IN', 'dcr': 'th_TH', 'cri': 'tl_XX', 'bzk': 'uk_UA', 'brc': 'ur_PK', 'bah': 'xh_ZA', 'aoa': 'gl_ES'}
|
25 |
# Note: We mapped languages to their language tokens manually. For example, we used en_XX, fr_XX, es_XX for English, French and Spanish as in the original mBART-50 model. But then we repurposed other tokens for Creoles.
|
26 |
|
27 |
# As for what the language codes and their corresponding languages are, please refer to: https://github.com/JHU-CLSP/Kreyol-MT?tab=readme-ov-file#building-machine-translation-for-latin-american-caribbean-and-colonial-african-creole-languages
|
28 |
|
29 |
+
inp = tokenizer('Wen dey wen stretch him out fo whip him real hard , Paul wen tell da captain dat stay dea , "Dis okay in da rules fo da Rome peopo ? fo you fo whip one guy dat get da same rights jalike da Rome peopo ? even one guy dat neva do notting wrong ?" </s> ko_KR', add_special_tokens=False, return_tensors="pt", padding=True).input_ids
|
30 |
|
31 |
model.eval() # Set dropouts to zero
|
32 |
|