Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,93 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
|
8 |
<!-- Provide a quick summary of what the model is/does. -->
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
14 |
### Model Description
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
## How to Get Started with the Model
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
-
|
|
|
|
|
|
|
112 |
|
113 |
-
|
|
|
|
|
|
|
114 |
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
-
|
118 |
|
119 |
-
[
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
|
175 |
**BibTeX:**
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
+
license: cc-by-sa-4.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: sentence-transformers
|
6 |
+
pipeline_tag: sentence-similarity
|
7 |
+
tags:
|
8 |
+
- topic-relatedness
|
9 |
+
- semantic-relatedness
|
10 |
+
base_model:
|
11 |
+
- sentence-transformers/distiluse-base-multilingual-cased-v1
|
12 |
---
|
13 |
|
14 |
+
# TRoTR-all-distilroberta-v1
|
15 |
|
16 |
<!-- Provide a quick summary of what the model is/does. -->
|
17 |
+
```FrancescoPeriti/TRoTR-distiluse-base-multilingual-cased-v1``` is a fine-tuned version of the ```sentence-transformers/distiluse-base-multilingual-cased-v1```.
|
18 |
|
19 |
+
**NOTE**: In our work, we performed cross-validation across 10 different folds.
|
20 |
+
For a given model (e.g., ```distiluse-base-multilingual-cased-v1```), this process involved fine-tuning 10 separate models and reporting the average performance across the test folds.
|
21 |
+
Rather than sharing all the fine-tuned models for each fold, we decided to provide only an example model for the [**FOLD1**](https://github.com/FrancescoPeriti/TRoTR/tree/main/TRoTR/datasets/FOLD_1).
|
22 |
+
Please note that the results in the paper are based on the averaged performance across all folds.
|
23 |
+
Therefore, the performance of this single model is not directly comparable to the results reported in the paper.
|
24 |
|
25 |
+
You can find more details in our paper [TRoTR: A Framework for Evaluating the Recontextualization of Text](https://aclanthology.org/2024.emnlp-main.774.pdf) by Francesco Periti, Pierluigi Cassotti, Stefano Montanelli, Nina Tahmasebi, and Dominik Schlechtweg.
|
26 |
+
The repository of our project is [https://github.com/FrancescoPeriti/TRoTR](https://github.com/FrancescoPeriti/TRoTR).
|
27 |
|
28 |
### Model Description
|
29 |
+
This model is designed to evaluate the topic relatedness of text reuse in different contexts.
|
30 |
|
31 |
+
The model is fine-tuned on the **TRoTR** dataset for _text recontextualization_ using _contrastive learning_.
|
32 |
+
Specifically, given a target text-reuse excerpt 𝑡 within two contexts 𝑐₁ and 𝑐₂,
|
33 |
+
the model is trained to minimize the embedding distance between 𝑐₁ and 𝑐₂ if they share the same topic,
|
34 |
+
and to maximize the distance if they don't share the same topic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
As an example, consider three recontextualizations of the biblical passage ```John 15:13```:
|
37 |
+
- (1) It’s the wonderful pride month!! ❤️🧡💛💚💙💜 Honestly pride is everyday! Love is love don’t forget I love you ❤️. Remember this! John 15:12-13:
|
38 |
+
“My command is this: Love each other as I have loved you. ```Greater love has no one than this: to lay down one’s life for one’s friends```”
|
39 |
+
- (2) At a large Crimean event today Putin quoted the Bible to defend the special military operation in Ukraine which has killed thousands and displaced millions. His
|
40 |
+
words “```There is no greater love than if someone gives soul for their friends```”. And people were cheering him. Madness!!!
|
41 |
+
- (3) “Freeing people from genocide is the reason, motive & goal of the military operation we started in the Donbas& Ukraine”, Putin says, then quotes the Bible: “```There
|
42 |
+
is no greater love than to lay down one’s life for one’s friends.```” It’s like Billy Graham meets North Korea
|
43 |
|
44 |
+
In this example, the biblical passage is incorporated within three texts with different topic recontextualizations. In particular, the text (1) has a different
|
45 |
+
topic with respect to text (2) and (3), while the texts (2) and (3) are topic related
|
|
|
46 |
|
47 |
## How to Get Started with the Model
|
48 |
+
```python
|
49 |
+
from sentence_transformers import SentenceTransformer
|
50 |
|
51 |
+
# Load the model
|
52 |
+
model = SentenceTransformer('FrancescoPeriti/TRoTR-distiluse-base-multilingual-cased-v1')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
# Example sentences for text recontextualization
|
55 |
+
context1 = "It's the wonderful pride month!! ❤️🧡💛💚💙💜 Honestly pride is everyday! Love is love don't forget I love you ❤️. Remember this! John 15:12-13: My command is this: Love each other as I have loved you. Greater love has no one than this: to lay down one's life for one's friends"
|
56 |
+
context2 = "At a large Crimean event today Putin quoted the Bible to defend the special military operation in Ukraine which has killed thousands and displaced millions. His words \"Greater love has no one than this: to lay down one's life for one's friends\". And people were cheering him. Madness!!!"
|
57 |
+
context3 = "\"Freeing people from genocide is the reason, motive and goal of the military operation we started in the Donbas and Ukraine\", Putin says, then quotes the Bible: \"Greater love has no one than this: to lay down one's life for one's friends\" It's like Billy Graham meets North Korea."
|
58 |
|
59 |
+
# Encode the two contexts into embeddings
|
60 |
+
embedding1 = model.encode([context1])
|
61 |
+
embedding2 = model.encode([context2])
|
62 |
+
embedding3 = model.encode([context3])
|
63 |
|
64 |
+
# Calculate similarity
|
65 |
+
similarity1 = model.similarity(embedding1, embedding2)
|
66 |
+
similarity2 = model.similarity(embedding1, embedding3)
|
67 |
+
similarity3 = model.similarity(embedding2, embedding3)
|
68 |
|
69 |
+
# Print the similarity score
|
70 |
+
print(f"Cosine similarities between the contexts: {similarity1}, {similarity2}, {similarity3}")
|
71 |
+
# Cosine similarities between the contexts: tensor([[0.4249]]), tensor([[0.4724]]), tensor([[0.8182]])
|
72 |
+
```
|
73 |
|
74 |
+
## Citation
|
75 |
|
76 |
+
Francesco Periti, Pierluigi Cassotti, Stefano Montanelli, Nina Tahmasebi, and Dominik Schlechtweg. 2024. [TRoTR: A Framework for Evaluating the Re-contextualization of Text Reuse](https://aclanthology.org/2024.emnlp-main.774/). In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 13972–13990, Miami, Florida, USA. Association for Computational Linguistics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
**BibTeX:**
|
79 |
+
```
|
80 |
+
@inproceedings{periti2024trotr,
|
81 |
+
title = {{TRoTR: A Framework for Evaluating the Re-contextualization of Text Reuse}},
|
82 |
+
author = "Periti, Francesco and Cassotti, Pierluigi and Montanelli, Stefano and Tahmasebi, Nina and Schlechtweg, Dominik",
|
83 |
+
editor = "Al-Onaizan, Yaser and Bansal, Mohit and Chen, Yun-Nung",
|
84 |
+
booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing",
|
85 |
+
month = nov,
|
86 |
+
year = "2024",
|
87 |
+
address = "Miami, Florida, USA",
|
88 |
+
publisher = "Association for Computational Linguistics",
|
89 |
+
url = "https://aclanthology.org/2024.emnlp-main.774",
|
90 |
+
pages = "13972--13990",
|
91 |
+
abstract = "Current approaches for detecting text reuse do not focus on recontextualization, i.e., how the new context(s) of a reused text differs from its original context(s). In this paper, we propose a novel framework called TRoTR that relies on the notion of topic relatedness for evaluating the diachronic change of context in which text is reused. TRoTR includes two NLP tasks: TRiC and TRaC. TRiC is designed to evaluate the topic relatedness between a pair of recontextualizations. TRaC is designed to evaluate the overall topic variation within a set of recontextualizations. We also provide a curated TRoTR benchmark of biblical text reuse, human-annotated with topic relatedness. The benchmark exhibits an inter-annotator agreement of .811. We evaluate multiple, established SBERT models on the TRoTR tasks and find that they exhibit greater sensitivity to textual similarity than topic relatedness. Our experiments show that fine-tuning these models can mitigate such a kind of sensitivity.",
|
92 |
+
}
|
93 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|