Views
No views yet
facebook/m2m100_418M (MIT) for Bekwarra (ISO 639-3 bkv), a
Bendi language of Cross River State, Nigeria, spoken by roughly 100,000 people.__bkv__ was added to the tokenizer and seeded from
Igbo before fine-tuning.Ibang h'uni ang'a de achi i na k'ufo uni irichom? → "What does a wise man do to the fool?"1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2
3tok = AutoTokenizer.from_pretrained("Lordkiki/dialingua-bkv-mt")
4model = AutoModelForSeq2SeqLM.from_pretrained("Lordkiki/dialingua-bkv-mt")
5
6# The language maps are rebuilt from a hardcoded list on load, so the added
7# code has to be re-registered or src_lang raises KeyError('bkv').
8bkv_id = tok.convert_tokens_to_ids("__bkv__")
9for attr, key, val in [("lang_code_to_token", "bkv", "__bkv__"),
10 ("lang_token_to_id", "__bkv__", bkv_id),
11 ("id_to_lang_token", bkv_id, "__bkv__"),
12 ("lang_code_to_id", "bkv", bkv_id)]:
13 getattr(tok, attr)[key] = val
14
15tok.src_lang = "bkv"
16enc = tok("Ibang h'uni ang'a de achi i na k'ufo uni irichom?", return_tensors="pt")
17out = model.generate(**enc, forced_bos_token_id=tok.convert_tokens_to_ids("__en__"),
18 num_beams=4, no_repeat_ngram_size=3)
19print(tok.batch_decode(out, skip_special_tokens=True)[0])k'uchu,
ng'amin, r'abe. Both the closed form and the spaced form (K' iye) occur
in current writing and both are handled.