Cross-Encoder for Word-Sense Relationship Classification

This model has been trained on word sense relations extracted from WordNet.

The model can be used to detect what kind of relationships (among homonymy, antonymy, hypernonymy, hyponymy, and co-hyponymy) occur between word senses: Given a pair of word sense definitions, predict the sense relationship (homonymy, antonymy, hypernonymy, hyponymy, and co-hyponymy).

The training code can be found here: https://github.com/ChangeIsKey/change-type-classification

Citation

@inproceedings{change_type_classification_cassotti_2024,
  author    = {Pierluigi Cassotti and
               Stefano De Pascale and
               Nina Tahmasebi},
  title     = {Using Synchronic Definitions and Semantic Relations to Classify Semantic Change Types},
  year      = {2024},
}

Usage with Transformers

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained('ChangeIsKey/change-type-classifier')
tokenizer = AutoTokenizer.from_pretrained('ChangeIsKey/change-type-classifier')


features = tokenizer([['to quickly take something in your hand(s) and hold it firmly', 'to understand something, especially something difficult'], ['To move at a leisurely and relaxed pace, typically by foot', 'To move or travel, irrespective of the mode of transportation']],  padding=True, truncation=True, return_tensors="pt")

model.eval()
with torch.no_grad():
    scores = model(**features).logits
    print(scores)

Usage with SentenceTransformers

The usage becomes easier when you have SentenceTransformers installed. Then, you can use the pre-trained models like this:

from sentence_transformers import CrossEncoder
model = CrossEncoder('ChangeIsKey/change-type-classifier', max_length=512)
labels = model.predict([('to quickly take something in your hand(s) and hold it firmly', 'to understand something, especially something difficult'), ('To move at a leisurely and relaxed pace, typically by foot', 'To move or travel, irrespective of the mode of transportation')])
Downloads last month
111
Safetensors
Model size
355M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported third-party Inference Providers, and the model is not deployed on the HF Inference API.