jahuerta92 commited on
Commit
28a0c70
·
verified ·
1 Parent(s): e0f022f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: feature-extraction
3
+ ---
4
+ # Style Transformer for Authorship Representations - STAR
5
+ This is the repository for the [Style Transformer for Authorship Representations (STAR)](https://arxiv.org/abs/2310.11081) model. We present the weights of our model here.
6
+
7
+ Also check out our [github repo for STAR](https://github.com/jahuerta92/star) for replication.
8
+
9
+ ## Feature extraction
10
+ ```
11
+ tokenizer = AutoTokenizer.from_pretrained('roberta-large')
12
+ model = AutoModel.from_pretrained('AIDA-UPM/star')
13
+
14
+ examples = ['My text 1', 'This is another text']
15
+
16
+ def extract_embeddings(texts):
17
+ encoded_texts = tokenizer(texts)
18
+ with torch.no_grad():
19
+ style_embeddings = model(encoded_texts.input_ids, attention_mask=encoded_texts.attention_mask)
20
+ return style_embeddings
21
+
22
+ print(extract_embeddings(examples))
23
+ ```
24
+
25
+ ## Citation
26
+ ```
27
+ @article{Huertas-Tato2023Oct,
28
+ author = {Huertas-Tato, Javier and Martin, Alejandro and Camacho, David},
29
+ title = {{Understanding writing style in social media with a supervised contrastively pre-trained transformer}},
30
+ journal = {arXiv},
31
+ year = {2023},
32
+ month = oct,
33
+ eprint = {2310.11081},
34
+ doi = {10.48550/arXiv.2310.11081}
35
+ }
36
+ ```