Downloads · 30 days
20
20% of all-time downloads
vllm-sr/mmbert-fact-check-lora
mmbert-fact-check-lora is a text classification model from vllm-sr. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as apache-2.0.
A multilingual binary classifier that determines whether a query requires external fact-checking or can be answered without verification.
Downloads · 30 days
20
20% of all-time downloads
All-time downloads
102
Public
Repo size
61.4 MB
Likes
0
Public
Click a slice to open those files.
.json34.4 MB · 56%
From the Hugging Face model README
A multilingual binary classifier that determines whether a query requires external fact-checking or can be answered without verification.
This model classifies prompts into two categories:
Supports 1800+ languages through mmBERT's multilingual pretraining.
| Metric | Score |
|---|---|
| Accuracy | 96.2% |
| F1 | 96.2% |
| Precision | 96.2% |
| Recall | 96.2% |
| Training Time | 151 seconds (MI300X GPU) |
FACT_CHECK_NEEDED:
NO_FACT_CHECK_NEEDED:
from peft import PeftModel
from transformers import AutoModelForSequenceClassification, AutoTokenizer
# Load model
base_model = AutoModelForSequenceClassification.from_pretrained(
"jhu-clsp/mmBERT-base", num_labels=2
)
model = PeftModel.from_pretrained(base_model, "vllm-sr/mmbert-fact-check-lora")
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/mmBERT-base")
# Classify
queries = [
"When was the Eiffel Tower built?", # FACT_CHECK_NEEDED
"Write a poem about the ocean", # NO_FACT_CHECK_NEEDED
]
for query in queries:
inputs = tokenizer(query, return_tensors="pt", truncation=True)
outputs = model(**inputs)
label = "FACT_CHECK_NEEDED" if outputs.logits.argmax(-1).item() == 1 else "NO_FACT_CHECK_NEEDED"
print(f"{query} -> {label}")
This model is part of the vLLM Semantic Router project.
Apache 2.0