trek90s commited on
Commit
e05d080
·
1 Parent(s): b931ed9

init README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -0
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - ABSA
5
+ - aspect-based-sentiment-analysis
6
+ - pytorch
7
+ datasets:
8
+ - semeval2014
9
+ widget:
10
+ - text: "[CLS] The appearance is very nice, but the battery life is poor. [SEP] appearance [SEP] "
11
+ ---
12
+
13
+ # Note
14
+
15
+ BERT based ABSA baseline, based on https://github.com/avinashsai/BERT-Aspect *BERT LSTM* implementation.
16
+
17
+ Code for the paper "Utilizing BERT Intermediate Layers for Aspect Based Sentiment Analysis and Natural Language Inference" https://arxiv.org/pdf/2002.04815.pdf.
18
+
19
+ When using the widget, please splice the aspect vocabulary behind the original sentence by [SEP].
20
+
21
+ # Usage
22
+
23
+ ```python
24
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
25
+
26
+ MODEL = "tezign/BERT-LSTM-based-ABSA"
27
+
28
+ tokenizer = AutoTokenizer.from_pretrained(MODEL)
29
+
30
+ model = AutoModelForSequenceClassification.from_pretrained(MODEL, trust_remote_code=True)
31
+
32
+ classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer)
33
+
34
+ result = classifier([
35
+ {"text": "The appearance is very nice, but the battery life is poor", "text_pair": "appearance"},
36
+ {"text": "The appearance is very nice, but the battery life is poor", "text_pair": "battery"}
37
+ ],
38
+ function_to_apply="softmax")
39
+
40
+ print(result)
41
+
42
+ """
43
+ print result
44
+ >> [{'label': 'positive', 'score': 0.9129462838172913}, {'label': 'negative', 'score': 0.8834680914878845}]
45
+ """
46
+
47
+ ```