antypasd commited on
Commit
0291a2a
1 Parent(s): 8cf23c8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -7
README.md CHANGED
@@ -1,9 +1,10 @@
1
  ---
2
- language:
3
- - en
4
  license: mit
5
  datasets:
6
  - cardiffnlp/super_tweeteval
 
 
 
7
  ---
8
  # cardiffnlp/twitter-roberta-base-intimacy-latest
9
 
@@ -13,15 +14,23 @@ The original Twitter-based RoBERTa model can be found [here](https://huggingface
13
  ## Example
14
  ```python
15
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
 
16
 
17
  model_name = "cardiffnlp/twitter-roberta-base-intimacy-latest"
18
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
19
  tokenizer = AutoTokenizer.from_pretrained(model_name)
20
 
21
-
22
  text= '@user Furthermore, harassment is ILLEGAL in any form!'
23
- model(**tokenizer(text, return_tensors="pt")).logits
24
- >> tensor([1.6744])
 
 
 
 
 
 
 
 
25
  ```
26
 
27
  ## Citation Information
@@ -34,5 +43,4 @@ Please cite the [reference paper](https://arxiv.org/abs/2310.14757) if you use t
34
  booktitle={Findings of the Association for Computational Linguistics: EMNLP 2023},
35
  year={2023}
36
  }
37
- ```
38
-
 
1
  ---
 
 
2
  license: mit
3
  datasets:
4
  - cardiffnlp/super_tweeteval
5
+ language:
6
+ - en
7
+ pipeline_tag: text-classification
8
  ---
9
  # cardiffnlp/twitter-roberta-base-intimacy-latest
10
 
 
14
  ## Example
15
  ```python
16
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
17
+ import torch.nn.functional as F
18
 
19
  model_name = "cardiffnlp/twitter-roberta-base-intimacy-latest"
20
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
21
  tokenizer = AutoTokenizer.from_pretrained(model_name)
22
 
 
23
  text= '@user Furthermore, harassment is ILLEGAL in any form!'
24
+
25
+ # with pipeline
26
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
27
+ pipe(text)
28
+ >> [{'label': 'LABEL_0', 'score': 0.5492708086967468}]
29
+
30
+ # alternatively
31
+ logits = model(**tokenizer(text, return_tensors="pt"))
32
+ prob = F.sigmoid(logits.logits).item()
33
+ >> 0.5492708086967468
34
  ```
35
 
36
  ## Citation Information
 
43
  booktitle={Findings of the Association for Computational Linguistics: EMNLP 2023},
44
  year={2023}
45
  }
46
+ ```