Views
No views yet
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|---|
| No log | 1.0 | 459 | 0.3905 | 0.8382 | 0.8878 |
| 0.5385 | 2.0 | 918 | 0.4275 | 0.8505 | 0.8961 |
| 0.3054 | 3.0 | 1377 | 0.5471 | 0.8652 | 0.9057 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3# Load model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("real-jiakai/bert-base-uncased-finetuned-mrpc")
5model = AutoModelForSequenceClassification.from_pretrained("real-jiakai/bert-base-uncased-finetuned-mrpc")
6
7# Example function
8def check_paraphrase(sentence1, sentence2):
9 inputs = tokenizer(sentence1, sentence2, return_tensors="pt", padding=True, truncation=True)
10 outputs = model(**inputs)
11 prediction = outputs.logits.argmax().item()
12 return "Paraphrase" if prediction == 1 else "Not paraphrase"
13
14# Example usage
15sentence1 = "The cat sat on the mat."
16sentence2 = "A cat was sitting on the mat."
17result = check_paraphrase(sentence1, sentence2)
18print(f"Result: {result}")