MT Accuracy Evaluation
Collection
Models trained on human translated datasets to help evaluate the accuracy of machine translated texts. • 1 item • Updated
This model predicts whether a Twi–English translation pair is correct (1) or incorrect (0).
It is based on intfloat/multilingual-e5-small and fine‑tuned on a synthetic dataset of word and sentence pairs.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_name = "ghananlpcommunity/twi-eng-qe-e5"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
def predict(twi, english):
text = f"query: {twi} passage: {english}"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
outputs = model(**inputs)
prob = outputs.logits.softmax(dim=-1)
return prob[0][1].item() # probability of "correct"
print(predict("me ho ye", "I am fine")) # expected > 0.5
print(predict("me ho ye", "The car is blue")) # expected < 0.5