Update README.md
Browse files
README.md
CHANGED
|
@@ -13,17 +13,61 @@ metrics:
|
|
| 13 |
tags:
|
| 14 |
- finance
|
| 15 |
---
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
### Sentiment Labels
|
| 25 |
-
The model
|
| 26 |
|
| 27 |
- ✅ **Positive**
|
| 28 |
- ❌ **Negative**
|
| 29 |
- ⚖ **Neutral**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
tags:
|
| 14 |
- finance
|
| 15 |
---
|
| 16 |
+
---
|
| 17 |
+
license: apache-2.0
|
| 18 |
+
datasets:
|
| 19 |
+
- takala/financial_phrasebank
|
| 20 |
+
language:
|
| 21 |
+
- en
|
| 22 |
+
metrics:
|
| 23 |
+
- f1
|
| 24 |
+
base_model:
|
| 25 |
+
- answerdotai/ModernBERT-large
|
| 26 |
+
new_version: ProsusAI/finbert
|
| 27 |
+
pipeline_tag: text-classification
|
| 28 |
+
library_name: transformers
|
| 29 |
+
tags:
|
| 30 |
+
- finance
|
| 31 |
+
- sentiment
|
| 32 |
+
- financial-sentiment-analysis
|
| 33 |
+
- sentiment-analysis
|
| 34 |
+
widget:
|
| 35 |
+
- text: "Stocks rallied and the British pound gained."
|
| 36 |
+
---
|
| 37 |
|
| 38 |
+
# Modern-FinBERT: Financial Sentiment Analysis
|
| 39 |
|
| 40 |
+
`Modern-FinBERT` is a **pre-trained NLP model** designed for **financial sentiment analysis**. It extends the [`ModernBERT-large`](https://huggingface.co/answerdotai/ModernBERT-large) language model by further training it on a **large financial corpus**, making it highly specialized for **financial text classification**.
|
| 41 |
|
| 42 |
+
For fine-tuning, the model leverages the **[Financial PhraseBank](https://www.researchgate.net/publication/251231107_Good_Debt_or_Bad_Debt_Detecting_Semantic_Orientations_in_Economic_Texts)** by Malo et al. (2014), a widely recognized benchmark dataset for financial sentiment analysis.
|
| 43 |
|
| 44 |
### Sentiment Labels
|
| 45 |
+
The model generates a **softmax probability distribution** across three sentiment categories:
|
| 46 |
|
| 47 |
- ✅ **Positive**
|
| 48 |
- ❌ **Negative**
|
| 49 |
- ⚖ **Neutral**
|
| 50 |
+
|
| 51 |
+
For more technical insights on `ModernBERT`, check out the research paper:
|
| 52 |
+
🔍 **[ModernBERT Technical Details](https://arxiv.org/abs/2412.13663)**
|
| 53 |
+
|
| 54 |
+
# How to use
|
| 55 |
+
You can use this model with Transformers pipeline for sentiment analysis.
|
| 56 |
+
```bash
|
| 57 |
+
pip install -U transformers
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 62 |
+
|
| 63 |
+
# Load the pre-trained model and tokenizer
|
| 64 |
+
model = AutoModelForSequenceClassification.from_pretrained('beethogedeon/Modern-FinBERT', num_labels=3)
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained('answerdotai/ModernBERT')
|
| 66 |
+
|
| 67 |
+
# Initialize the NLP pipeline
|
| 68 |
+
nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
| 69 |
+
|
| 70 |
+
sentence = "Stocks rallied and the British pound gained."
|
| 71 |
+
|
| 72 |
+
print(nlp(sentence))
|
| 73 |
+
```
|