add model
Browse files
README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
widget:
|
| 4 |
+
- text: "drawing of tintin in a shop"
|
| 5 |
+
output:
|
| 6 |
+
url: "https://github.com/ChangeIsKey/change-type-classification/blob/main/lsc_ctd_benchmark_snippet_table.png"
|
| 7 |
+
---
|
| 8 |
+
# Cross-Encoder for Word Sense Relationships Classification
|
| 9 |
+
|
| 10 |
+
This model was trained on word sense relationships extracted by WordNet for the [semantic change type classification](https://github.com/ChangeIsKey/change-type-classification).
|
| 11 |
+
|
| 12 |
+
The model can be used to detect which kind of relatioships (among homonymy, antonymy, hypernonym, hyponymy, and co-hypnomy) intercur between word senses: Given a pair of word sense definitions, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order.
|
| 13 |
+
|
| 14 |
+
The training code is available here: [SBERT.net Training MS Marco](https://github.com/UKPLab/sentence-transformers/tree/master/examples/training/ms_marco)
|
| 15 |
+
|
| 16 |
+
<b> Citation </b>
|
| 17 |
+
|
| 18 |
+
```
|
| 19 |
+
@inproceedings{change_type_classification_cassotti_2024,
|
| 20 |
+
author = {Pierluigi Cassotti and
|
| 21 |
+
Stefano De Pascale and
|
| 22 |
+
Nina Tahmasebi},
|
| 23 |
+
title = {Using Synchronic Definitions and Semantic Relations to Classify Semantic Change Types},
|
| 24 |
+
year = {2024},
|
| 25 |
+
}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
## Usage with Transformers
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 33 |
+
import torch
|
| 34 |
+
|
| 35 |
+
model = AutoModelForSequenceClassification.from_pretrained('model_name')
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained('model_name')
|
| 37 |
+
|
| 38 |
+
features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'], padding=True, truncation=True, return_tensors="pt")
|
| 39 |
+
|
| 40 |
+
model.eval()
|
| 41 |
+
with torch.no_grad():
|
| 42 |
+
scores = model(**features).logits
|
| 43 |
+
print(scores)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
## Usage with SentenceTransformers
|
| 48 |
+
|
| 49 |
+
The usage becomes easier when you have [SentenceTransformers](https://www.sbert.net/) installed. Then, you can use the pre-trained models like this:
|
| 50 |
+
```python
|
| 51 |
+
from sentence_transformers import CrossEncoder
|
| 52 |
+
model = CrossEncoder('model_name', max_length=512)
|
| 53 |
+
labels = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
## Performance
|
| 58 |
+
In the following table, we provide various pre-trained Cross-Encoders together with their performance on the
|
| 59 |
+
|
| 60 |
+
<Gallery />
|