Views
No views yet
<tgt>word</tgt> in both sentences before encoding.| Split | Accuracy |
|---|---|
| Validation | 0.7524 |
| Test | 0.7264 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("Deehan1866/finetuned-deberta-wic")
5model = AutoModelForSequenceClassification.from_pretrained("Deehan1866/finetuned-deberta-wic")
6
7word = "bank"
8s1 = f"The <tgt>{word}</tgt> raised its interest rates."
9s2 = f"She visited her local <tgt>{word}</tgt> to deposit a cheque."
10
11enc = tokenizer(s1, s2, return_tensors="pt", truncation=True, max_length=256)
12with torch.no_grad():
13 logits = model(**enc).logits
14pred = torch.argmax(logits).item()
15print("Same sense" if pred == 1 else "Different sense")