Downloads · 30 days
11
17% of all-time downloads
Deehan1866/wic-rationalefullymasked-structbert-large
wic-rationalefullymasked-structbert-large is a machine learning model from Deehan1866. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Cross-encoder model for the Word-in-Context (WiC) binary sense disambiguation task. Both sentences — plus an LLM-generated rationale — are fed together so the model can attend across them simultaneously.
Downloads · 30 days
11
17% of all-time downloads
All-time downloads
64
Public
Parameters
335M
1.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.3 GB · 100%
From the Hugging Face model README
Cross-encoder model for the Word-in-Context (WiC) binary sense disambiguation task. Both sentences — plus an LLM-generated rationale — are fed together so the model can attend across them simultaneously.
bayartsogt/structbert-large
[CLS] sentence1_marked [SEP] sentence2_marked [SEP] rationale [SEP]
The target word is wrapped with <TGT>word</TGT> using the exact token position
from the dataset (start1/start2 columns), so marking is always precise regardless
of lemma or morphological variation.
| Split | Accuracy |
|---|---|
| Validation | 0.7147 |
| Test | 0.7271 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("Deehan1866/wic-rationalefullymasked-structbert-large")
model = AutoModelForSequenceClassification.from_pretrained("Deehan1866/wic-rationalefullymasked-structbert-large")
s1 = "The <TGT>bank</TGT> raised its interest rates."
s2 = "She visited her local <TGT>bank</TGT> to deposit a cheque."
rationale = "In the first sentence 'bank' refers to a financial institution; in the second it also refers to a financial institution."
sep = tokenizer.sep_token
enc = tokenizer(s1, s2 + " " + sep + " " + rationale,
return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
logits = model(**enc).logits
pred = torch.argmax(logits).item()
print("Same sense" if pred == 1 else "Different sense")