nhuvo/En-ViMedNER
Preview • Updated • 411
How to use nhuvo/umt5-base-en-vimedner-direct-trans-ner-en2vi with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "translation" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("translation", model="nhuvo/umt5-base-en-vimedner-direct-trans-ner-en2vi") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("nhuvo/umt5-base-en-vimedner-direct-trans-ner-en2vi")
model = AutoModelForSeq2SeqLM.from_pretrained("nhuvo/umt5-base-en-vimedner-direct-trans-ner-en2vi", device_map="auto")google/umt5-base fine-tuned on En-ViMedNER for M1: Direct Trans.+NER (English → Vietnamese).
One-shot cross-lingual NER via translation: the model translates and inserts entity tags in the target in a single pass.
| Input | Plain English biomedical sentence (no tags) |
| Output | Vietnamese translation with inline entity markup |
Example shape:
Patients with type 2 diabetes mellitus were enrolled.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.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
repo = "nhuvo/umt5-base-en-vimedner-direct-trans-ner-en2vi"
tok = AutoTokenizer.from_pretrained(repo)
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, max_new_tokens=256)
print(tok.decode(outputs[0], skip_special_tokens=True))
nhuvo/umt5-base-en-vimedner-direct-trans-ner-vi2enBase model
google/umt5-base