Downloads · 30 days
3
10% of all-time downloads
heroiclunatic/finbert-finance-classification
finbert-finance-classification is a machine learning model from heroiclunatic. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
FinBERT Financial Sentiment Classification Model Description Purpose: This model is a fine-tuned version of BERT, adapted for financial sentiment classification. It is specifically designed to classify financial text…
Downloads · 30 days
3
10% of all-time downloads
All-time downloads
29
Public
Parameters
110M
439 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors439 MB · 100%
From the Hugging Face model README
FinBERT Financial Sentiment Classification Model Description Purpose: This model is a fine-tuned version of BERT, adapted for financial sentiment classification. It is specifically designed to classify financial text into categories like positive, negative, and neutral. Architecture: Based on the BERT architecture, this model has been fine-tuned on financial texts, optimizing it for use in sentiment analysis within the finance sector. Training Data: The model was trained on a financial dataset containing news headlines, analyst reports, and other finance-related text sources, labeled for sentiment. Intended Use Cases: Ideal for applications in finance, such as analyzing news articles, earnings reports, and social media for sentiment to aid in investment analysis, trading decisions, or financial forecasting. Framework: PyTorch with Hugging Face Transformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("heroiclunatic/finbert-finance-classification")
model = AutoModelForSequenceClassification.from_pretrained("heroiclunatic/finbert-finance-classification")
# Sample text
text = "Elon musk reports that all the board of directors of tesla resign"
# Preprocess text
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
# Get sentiment scores
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=1).item()
labels = ["Negative", "Neutral", "Positive"]
print(f"Sentiment: {labels[predicted_class]}")