yiyanghkust
commited on
Commit
•
07a4cbb
1
Parent(s):
ea0b7e7
Update README.md
Browse files
README.md
CHANGED
@@ -5,4 +5,24 @@
|
|
5 |
|
6 |
More details on `FinBERT`: [Click Link](https://github.com/yya518/FinBERT)
|
7 |
|
8 |
-
This released `finbert-tone` model is the `FinBERT` model fine-tuned on 10,000 manually annotated (positive, negative, neutral) sentences from analyst reports. This model achieves superior performance on financial tone analysis task. If you are simply interested in using `FinBERT` for financial tone analysis, give it a try.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
More details on `FinBERT`: [Click Link](https://github.com/yya518/FinBERT)
|
7 |
|
8 |
+
This released `finbert-tone` model is the `FinBERT` model fine-tuned on 10,000 manually annotated (positive, negative, neutral) sentences from analyst reports. This model achieves superior performance on financial tone analysis task. If you are simply interested in using `FinBERT` for financial tone analysis, give it a try.
|
9 |
+
|
10 |
+
# How to use
|
11 |
+
You can use this model with Transformers pipeline for sentiment analysis.
|
12 |
+
```
|
13 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
14 |
+
from transformers import pipeline
|
15 |
+
|
16 |
+
finbert = BertForSequenceClassification.from_pretrained('yiyanghkust/finbert-tone',num_labels=3)
|
17 |
+
tokenizer = BertTokenizer.from_pretrained('yiyanghkust/finbert-tone')
|
18 |
+
|
19 |
+
nlp = pipeline("sentiment-analysis", model=finbert, tokenizer=tokenizer)
|
20 |
+
|
21 |
+
sentences = ["there is a shortage of capital, and we need extra financing",
|
22 |
+
"growth is strong and we have plenty of liquidity",
|
23 |
+
"there are doubts about our finances",
|
24 |
+
"profits are flat"]
|
25 |
+
results = nlp(sentences)
|
26 |
+
print(results)
|
27 |
+
|
28 |
+
```
|