Downloads · 30 days
9
39% of all-time downloads
imkiasu/roberta_finance_sentiment
roberta_finance_sentiment is a machine learning model from imkiasu. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository contains a RoBERTa-based model for financial sentiment classification. The model predicts whether a financial news headline or sentence is positive, neutral, or negative.
Downloads · 30 days
9
39% of all-time downloads
All-time downloads
23
Public
Parameters
355M
2.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
This repository contains a RoBERTa-based model for financial sentiment classification. The model predicts whether a financial news headline or sentence is positive, neutral, or negative.
roberta_finance_sentiment/
config.json
merges.txt
model.safetensors
special_tokens_map.json
tokenizer_config.json
tokenizer.json
vocab.json
Note: Only the model files are stored in roberta_finance_sentiment/. Scripts and datasets are kept separate and are not included in this folder or in the model upload.
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Directory of the model folder
model_dir = "roberta_finance_sentiment"
# read the model
tokenizer = AutoTokenizer.from_pretrained(model_dir)
model = AutoModelForSequenceClassification.from_pretrained(model_dir)
model.eval()
# Example
text = "Apple stock surges after strong earnings report."
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=1).item()
label_map = {0: 'negative', 1: 'neutral', 2: 'positive'}
print(f"Predicted sentiment: {label_map[pred]}")
roberta_finance_sentiment/ folder contains only the files needed for inference.Date: June 2025