File size: 2,083 Bytes
fcabb00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329111f
 
fcabb00
 
8cd51c5
fcabb00
329111f
8cd51c5
329111f
8cd51c5
 
329111f
8cd51c5
 
 
329111f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
license: apache-2.0
datasets:
- takala/financial_phrasebank
language:
- en
metrics:
- f1
base_model:
- answerdotai/ModernBERT-large
new_version: ProsusAI/finbert
pipeline_tag: text-classification
library_name: transformers
tags:
- finance
- sentiment
- financial-sentiment-analysis
- sentiment-analysis
widget:
- text: "Stocks rallied and the British pound gained."
---

# Modern-FinBERT-large: Financial Sentiment Analysis  

[`Modern-FinBERT-large`](https://huggingface.co/answerdotai/ModernBERT-large) 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**.  

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.  

### Sentiment Labels  
The model generates a **softmax probability distribution** across three sentiment categories:  

- โœ… **Positive**  
- โŒ **Negative**  
- โš– **Neutral**  

For more technical insights on `ModernBERT`, check out the research paper:  
๐Ÿ” **[ModernBERT Technical Details](https://arxiv.org/abs/2412.13663)**  

# How to use
You can use this model with Transformers pipeline for sentiment analysis.
```bash
pip install -U transformers
```

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline

# Load the pre-trained model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained('beethogedeon/Modern-FinBERT-large', num_labels=3)
tokenizer = AutoTokenizer.from_pretrained('answerdotai/ModernBERT-large')

# Initialize the NLP pipeline
nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)

sentence = "Stocks rallied and the British pound gained."

print(nlp(sentence))
```