trek90s
commited on
Commit
·
2a65f35
1
Parent(s):
b061262
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: zh
|
3 |
+
tags:
|
4 |
+
- sentiment-analysis
|
5 |
+
- pytorch
|
6 |
+
widget:
|
7 |
+
- text: "房间非常非常小,内窗,特别不透气,因为夜里走廊灯光是亮的,内窗对着走廊,窗帘又不能完全拉死,怎么都会有一道光射进来。"
|
8 |
+
- text: "房间干净,床垫和被子都很舒服。"
|
9 |
+
- text: "很好,干净整洁,交通方便。"
|
10 |
+
---
|
11 |
+
|
12 |
+
# Note
|
13 |
+
|
14 |
+
BERT based sentiment analysis, finetune based on https://huggingface.co/IDEA-CCNL/Erlangshen-Roberta-330M-Sentiment .The model trained on hotel human review chinese datasets.
|
15 |
+
|
16 |
+
# Usage
|
17 |
+
|
18 |
+
```python
|
19 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
|
20 |
+
|
21 |
+
MODEL = "tezign/Erlangshen-Sentiment-FineTune"
|
22 |
+
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
24 |
+
|
25 |
+
model = AutoModelForSequenceClassification.from_pretrained(MODEL, trust_remote_code=True)
|
26 |
+
|
27 |
+
classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer)
|
28 |
+
|
29 |
+
result = classifier("很好,干净整洁,交通方便。")
|
30 |
+
|
31 |
+
print(result)
|
32 |
+
|
33 |
+
"""
|
34 |
+
print result
|
35 |
+
>> [{'label': 'Positive', 'score': 0.989660382270813}]
|
36 |
+
"""
|
37 |
+
```
|