nyu-mll/glue
Viewer • Updated • 1.49M • 485k • 498
How to use shimogerald/bert-base-uncased-mrpc with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="shimogerald/bert-base-uncased-mrpc") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("shimogerald/bert-base-uncased-mrpc")
model = AutoModelForSequenceClassification.from_pretrained("shimogerald/bert-base-uncased-mrpc")This model is a fine-tuned version of bert-base-uncased on the GLUE MRPC dataset (paraphrase detection — predict whether two sentences are equivalent).
On the MRPC validation set:
| Metric | Value |
|---|---|
| Accuracy | 0.8750 |
| F1 | 0.9119 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("shimogerald/bert-base-uncased-mrpc")
model = AutoModelForSequenceClassification.from_pretrained("shimogerald/bert-base-uncased-mrpc")
inputs = tokenizer("The cat sat on the mat.", "A cat is sitting on a mat.",
return_tensors="pt", truncation=True)
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=1).item()
print("equivalent" if pred == 1 else "not equivalent")
Base model
google-bert/bert-base-uncased