π¦ LAPEFT: Financial Sentiment Analysis
A fine-tuned BERT model with LoRA for financial sentiment analysis. This model classifies financial text into three categories: Negative, Neutral, and Positive.
Model Details
- Base Model: bert-base-uncased
- Fine-tuning: LoRA (Low-Rank Adaptation)
- Classes: 3 (Negative, Neutral, Positive)
- Domain: Financial text analysis
- Language: English
Usage
Quick Start with Pipeline
from transformers import pipeline
# Load the model
classifier = pipeline(
"text-classification",
model="Hananguyen12/LAPEFT-Financial-Sentiment-Analysis"
)
# Analyze sentiment
text = "The company reported strong quarterly earnings."
result = classifier(text)
print(result)
# Output: [{'label': 'POSITIVE', 'score': 0.9234}]
Advanced Usage
from transformers import BertTokenizer, BertForSequenceClassification
from peft import PeftModel
# Load model components
base_model = BertForSequenceClassification.from_pretrained(
"bert-base-uncased",
num_labels=3
)
model = PeftModel.from_pretrained(base_model, "Hananguyen12/LAPEFT-Financial-Sentiment-Analysis")
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
# Inference
text = "The quarterly results exceeded expectations."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1)
labels = ["NEGATIVE", "NEUTRAL", "POSITIVE"]
print(f"Predicted: {labels[predicted_class]}")
Model Performance
- Optimized for financial text analysis
- Efficient LoRA fine-tuning approach
- Suitable for real-time sentiment analysis
Use Cases
- Financial news sentiment analysis
- Social media monitoring for financial content
- Investment research and analysis
- Risk assessment based on sentiment
Limitations
- Trained primarily on English financial text
- Performance may vary on non-financial content
- Best suited for sentences and short paragraphs
Citation
@misc{lapeft_financial_sentiment_2025,
title={LAPEFT: Financial Sentiment Analysis with LoRA},
author={Hananguyen12},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/Hananguyen12/LAPEFT-Financial-Sentiment-Analysis}
}
- Downloads last month
- 13
Model tree for Hananguyen12/LAPEFT-Financial-Sentiment-Analysis
Base model
google-bert/bert-base-uncased