twi-eng-qe-e5 / README.md
michsethowusu's picture
Update README.md
62f0513 verified
|
Raw
History Blame Contribute Delete
1.33 kB
metadata
language:
  - tw
  - en
license: apache-2.0
tags:
  - quality-estimation
  - translation
  - twi
  - e5
  - classification
pipeline_tag: text-classification

Twi–English Translation Quality Estimation

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.

Usage

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

Training Details

  • Base model: intfloat/multilingual-e5-small
  • Data: Human source parallel corpus (Twi–English) of 230217 examples
  • Test Accuracy: 0.9052210928676918
  • Test F1: 0.9152752970412363