File size: 1,968 Bytes
832d550
 
 
 
 
 
 
 
 
 
1b3a96e
832d550
1b3a96e
 
832d550
1b3a96e
 
 
 
832d550
b0147bb
 
1b3a96e
 
 
832d550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
base_model: FacebookAI/xlm-roberta-large
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---

# Multilingual Style Representation

This is the Style Representation model, presented in ``Leveraging Multilingual Training for Authorship Representation:
Enhancing Generalization across Languages and Domains``.

The Style Representation model encodes documents written by the same author as nearby vectors in the embedding space.
The model can be used for authorship attribution, style similarity, machine-generated text detection, and more.

For training and evaluation code, refer to our repository [here](https://github.com/junghwanjkim/multilingual_aa).

For the Style Representation model based on Llama-3.2, refer to [Blablablab/multilingual-style-representation-Llama-3.2](https://huggingface.co/Blablablab/multilingual-style-representation-Llama-3.2).

## Model Details
- **Model Type:** [Sentence Transformer](https://www.SBERT.net)
- **Base model:** [FacebookAI/xlm-roberta-large](https://huggingface.co/FacebookAI/xlm-roberta-large)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 1024 dimensions
- **Similarity Function:** Cosine Similarity

## Usage

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("Blablablab/multilingual-style-representation")
# Run inference
sentences = [
    'The weather is lovely today.',
    "It's so sunny outside!",
    'He drove to the stadium.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```

<!--
## Citation
-->