question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No documentation on how use nllb

See original GitHub issue

📚 Documentation

Hey there,

I am trying to play with nllb but there isn’t a basic code sample to try it.

I can download the checkpoint.pt but I am not sure what I would do afterwards.

I notice it’s also not available on torch.hub

Can you provide a piece of example code to get a translation?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
pluiezcommented, Jul 10, 2022

@314esther @Suhail Hi, You can check here for a convenient script to run the model inference from the command line without having to dealing with the config files.

4reactions
geonmcommented, Jul 19, 2022

Hi guys. I tested NLLB using huggingface transformers.

NOTE: You should install the latest dev version using below instruction in order to use NLLB tokenizer.

$ pip install git+https://github.com/huggingface/transformers.git

then… test it!

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline

# available models: 'facebook/nllb-200-distilled-600M', 'facebook/nllb-200-1.3B', 'facebook/nllb-200-distilled-1.3B', 'facebook/nllb-200-3.3B'
model_name = 'facebook/nllb-200-distilled-600M'

model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

source = 'eng_Latn' # English
target = 'kor_Hang' # Korean
translator = pipeline('translation', model=model, tokenizer=tokenizer, src_lang=source, tgt_lang=target)

text = 'Hi, nice to meet you'

output = translator(text, max_length=400)

translated_text = output[0]['translation_text']

print(translated_text) # '안녕하세요, 반가워요'

Language code is described in FLORES-200

Update: I made the huggingface space demo: https://huggingface.co/spaces/Geonmo/nllb-translation-demo

Read more comments on GitHub >

github_iconTop Results From Across the Web

NLLB - Hugging Face
We're on a journey to advance and democratize artificial intelligence through open source and open science.
Read more >
Text Translation Tutorial using NLLB and DL | MLearning.ai
Text Language Detection and Text Translation tutorial using No Language Left Behind and fasttext from Meta AI (FAIR). ... No documentation on how...
Read more >
No Language Left Behind - Meta AI Research Topic
No Language Left Behind (NLLB) is a first-of-its-kind, AI breakthrough project that open-sources models capable of delivering evaluated, high-quality ...
Read more >
Meta Releases NLLB-200, New Open-Source Model Able To ...
Meta AI has revealed a new model today called NLLB-200 (No Language Left Behind), a new 54-billion parameter translation model. The model ...
Read more >
No Language Left Behind (NLLB) - Zeta Alpha
The first thing that we tried to do in NLLB is really understanding, okay, ... Like, if you have to wait five minutes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found