nhuvo/nllb-600m-en-vimedner-direct-trans-ner-en2vi
023
nllb-600m-en-vimedner-direct-trans-ner-en2vi
`facebook/nllb-200-distilled-600M` fine-tuned on En-ViMedNER for M1: Direct Trans.+NER (English → Vietnamese).
What it does
One-shot cross-lingual NER via translation: the model translates and inserts entity tags in the target in a single pass.
Example shape:
- Input:
Patients with type 2 diabetes mellitus were enrolled. - Output:
Bệnh nhân mắc <BIOLOGIC_FUNCTION>đái tháo đường típ 2</BIOLOGIC_FUNCTION> được tuyển vào nghiên cứu.
Tags follow En-ViMedNER type names (such as <CHEMICAL>...</CHEMICAL>, <BIOLOGIC_FUNCTION>...</BIOLOGIC_FUNCTION>). Full label inventory, splits, and citation: [nhuvo/En-ViMedNER](https://huggingface.co/datasets/nhuvo/En-ViMedNER).
Usage
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
repo = "nhuvo/nllb-600m-en-vimedner-direct-trans-ner-en2vi"
tok = AutoTokenizer.from_pretrained(repo, src_lang="eng_Latn")
model = AutoModelForSeq2SeqLM.from_pretrained(repo)
prefix = "translate English to Vietnamese with inline named entity tags: "
text = "Patients with type 2 diabetes mellitus were enrolled."
inputs = tok(prefix + text, return_tensors="pt")
outputs = model.generate(
**inputs,
forced_bos_token_id=tok.convert_tokens_to_ids("vie_Latn"),
max_new_tokens=256,
)
print(tok.batch_decode(outputs, skip_special_tokens=True)[0])Related
- Pair model (VI→EN): `nhuvo/nllb-600m-en-vimedner-direct-trans-ner-vi2en`
