thammegowda / nllb-serve

Meta's "No Language Left Behind" models served as web app and REST API
http://rtg.isi.edu/nllb/
172 stars 23 forks source link

NllbTokenizerFast' object has no attribute 'lang_code_to_id #20

Open Devloper-Sigmoid opened 1 month ago

Devloper-Sigmoid commented 1 month ago

NllbTokenizerFast' object has no attribute 'lang_code_to_id

GOvEy1nw commented 1 month ago

hey, I found a fix for this.

line 145 in app.py needs changing from:

**inputs, forced_bos_token_id=tokenizer.lang_code_to_id[tgt_lang],

To:

**inputs, forced_bos_token_id=tokenizer.convert_tokens_to_ids(tgt_lang),

snap-star commented 1 month ago

hey, I found a fix for this.

line 145 in app.py needs changing from:

**inputs, forced_bos_token_id=tokenizer.lang_code_to_id[tgt_lang],

To:

**inputs, forced_bos_token_id=tokenizer.convert_tokens_to_ids(tgt_lang),

thanks a lot man!