Text Classification
Transformers
PyTorch
TensorFlow
JAX
Safetensors
English
bert
financial-sentiment-analysis
sentiment-analysis
finance
Instructions to use ProsusAI/finbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ProsusAI/finbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ProsusAI/finbert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ProsusAI/finbert") model = AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Lead with model information, move license terms to the end
Browse files
README.md
CHANGED
|
@@ -10,15 +10,31 @@ widget:
|
|
| 10 |
|
| 11 |
# FinBERT
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
The FinBERT model weights are made available under **CC BY-NC-SA 4.0**
|
| 17 |
-
(Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International).
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
### Training Data Attribution
|
| 24 |
This model was trained using the **Financial PhraseBank** dataset:
|
|
@@ -33,6 +49,42 @@ The Financial PhraseBank dataset is licensed under **CC BY-NC-SA 3.0**.
|
|
| 33 |
The underlying language model was further pre-trained on a subset of the
|
| 34 |
Reuters TRC2 corpus, which is distributed by NIST under its own access terms.
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
## ⚠️ User Responsibilities
|
| 37 |
|
| 38 |
**You are solely responsible for**:
|
|
@@ -58,24 +110,3 @@ for this model.
|
|
| 58 |
|
| 59 |
**LIABILITY**: In no event shall MIH AI B.V. or Prosus be liable for any
|
| 60 |
claim, damages, or other liability arising from the use of this model.
|
| 61 |
-
|
| 62 |
-
## Model Description
|
| 63 |
-
|
| 64 |
-
FinBERT is a pre-trained NLP model to analyze sentiment of financial text. It is built by further training the BERT language model in the finance domain, using a large financial corpus and thereby fine-tuning it for financial sentiment classification. [Financial PhraseBank](https://www.researchgate.net/publication/251231107_Good_Debt_or_Bad_Debt_Detecting_Semantic_Orientations_in_Economic_Texts) by Malo et al. (2014) is used for fine-tuning. For more details, please see the paper [FinBERT: Financial Sentiment Analysis with Pre-trained Language Models](https://arxiv.org/abs/1908.10063) and our related [blog post](https://medium.com/prosus-ai-tech-blog/finbert-financial-sentiment-analysis-with-bert-b277a3607101) on Medium.
|
| 65 |
-
|
| 66 |
-
The model will give softmax outputs for three labels: positive, negative or neutral.
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
About Prosus
|
| 71 |
-
|
| 72 |
-
Prosus is a global consumer internet group and one of the largest technology investors in the world. Operating and investing globally in markets with long-term growth potential, Prosus builds leading consumer internet companies that empower people and enrich communities. For more information, please visit www.prosus.com.
|
| 73 |
-
|
| 74 |
-
## 📧 Contact
|
| 75 |
-
|
| 76 |
-
For questions about this research project:
|
| 77 |
-
- Dogu Araci: dogu.araci[at]prosus.com
|
| 78 |
-
- Zulkuf Genc: zulkuf.genc[at]prosus.com
|
| 79 |
-
|
| 80 |
-
**Note**: Questions about commercial licensing or legal permissions
|
| 81 |
-
cannot be addressed by the research team. See the License section above.
|
|
|
|
| 10 |
|
| 11 |
# FinBERT
|
| 12 |
|
| 13 |
+
FinBERT is a pre-trained NLP model to analyze sentiment of financial text. It is built by further training the BERT language model in the finance domain, using a large financial corpus and thereby fine-tuning it for financial sentiment classification. [Financial PhraseBank](https://www.researchgate.net/publication/251231107_Good_Debt_or_Bad_Debt_Detecting_Semantic_Orientations_in_Economic_Texts) by Malo et al. (2014) is used for fine-tuning. For more details, please see the paper [FinBERT: Financial Sentiment Analysis with Pre-trained Language Models](https://arxiv.org/abs/1908.10063) and our related [blog post](https://medium.com/prosus-ai-tech-blog/finbert-financial-sentiment-analysis-with-bert-b277a3607101) on Medium.
|
| 14 |
|
| 15 |
+
The model will give softmax outputs for three labels: positive, negative or neutral.
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
## How to use
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import pipeline
|
| 21 |
+
|
| 22 |
+
classifier = pipeline("text-classification", model="ProsusAI/finbert")
|
| 23 |
+
classifier("Stocks rallied and the British pound gained.")
|
| 24 |
+
# [{'label': 'positive', 'score': 0.898...}]
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
To get the scores for all three labels, pass `top_k=None` to the classifier.
|
| 28 |
+
|
| 29 |
+
## Model details
|
| 30 |
+
|
| 31 |
+
- **Architecture**: BERT base (12 layers, hidden size 768, 12 attention heads) with a sequence classification head
|
| 32 |
+
- **Labels**: `0` positive, `1` negative, `2` neutral
|
| 33 |
+
- **Language**: English
|
| 34 |
+
- **Frameworks**: weights are available for PyTorch, TensorFlow and JAX/Flax
|
| 35 |
+
- **Code**: training and prediction code is on [GitHub](https://github.com/ProsusAI/finBERT)
|
| 36 |
+
|
| 37 |
+
## Training data
|
| 38 |
|
| 39 |
### Training Data Attribution
|
| 40 |
This model was trained using the **Financial PhraseBank** dataset:
|
|
|
|
| 49 |
The underlying language model was further pre-trained on a subset of the
|
| 50 |
Reuters TRC2 corpus, which is distributed by NIST under its own access terms.
|
| 51 |
|
| 52 |
+
## Citation
|
| 53 |
+
|
| 54 |
+
```bibtex
|
| 55 |
+
@article{araci2019finbert,
|
| 56 |
+
title={FinBERT: Financial Sentiment Analysis with Pre-trained Language Models},
|
| 57 |
+
author={Araci, Dogu},
|
| 58 |
+
journal={arXiv preprint arXiv:1908.10063},
|
| 59 |
+
year={2019}
|
| 60 |
+
}
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## About Prosus
|
| 64 |
+
|
| 65 |
+
Prosus is a global consumer internet group and one of the largest technology investors in the world. Operating and investing globally in markets with long-term growth potential, Prosus builds leading consumer internet companies that empower people and enrich communities. For more information, please visit www.prosus.com.
|
| 66 |
+
|
| 67 |
+
## 📧 Contact
|
| 68 |
+
|
| 69 |
+
For questions about this research project:
|
| 70 |
+
- Dogu Araci: dogu.araci[at]prosus.com
|
| 71 |
+
- Zulkuf Genc: zulkuf.genc[at]prosus.com
|
| 72 |
+
|
| 73 |
+
**Note**: Questions about commercial licensing or legal permissions
|
| 74 |
+
cannot be addressed by the research team. See the License section below.
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## 📜 License and Usage Terms
|
| 79 |
+
|
| 80 |
+
### Model Weights License
|
| 81 |
+
The FinBERT model weights are made available under **CC BY-NC-SA 4.0**
|
| 82 |
+
(Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International).
|
| 83 |
+
|
| 84 |
+
**This license restricts commercial use.** You may use this model for
|
| 85 |
+
non-commercial purposes only, and any adaptations must be shared under
|
| 86 |
+
the same license.
|
| 87 |
+
|
| 88 |
## ⚠️ User Responsibilities
|
| 89 |
|
| 90 |
**You are solely responsible for**:
|
|
|
|
| 110 |
|
| 111 |
**LIABILITY**: In no event shall MIH AI B.V. or Prosus be liable for any
|
| 112 |
claim, damages, or other liability arising from the use of this model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|