Team Ai
Modelpublic

Hananguyen12/LAPEFT-Financial-Sentiment-Analysis

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes13downloads
Model Card

๐Ÿฆ 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

python
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

python
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

bibtex
@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}
}