Downloads · 30 days
0
diwakartiwari/mistral-7b-financial-sentiment
mistral-7b-financial-sentiment is a text classification model from diwakartiwari. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as unknown.
Mistral-7B Financial Sentiment Analyzer is a fine-tuned version of mistralai/Mistral-7B-v0.1, designed specifically for financial sentiment analysis. It classifies financial texts into positive, negative, or neutral c…
Downloads · 30 days
0
Access
Public
Updated Jun 1, 2025
Repo size
168 MB
Likes
2
Public
Click a slice to open those files.
.safetensors168 MB · 98%
From the Hugging Face model README
Mistral-7B Financial Sentiment Analyzer is a fine-tuned version of mistralai/Mistral-7B-v0.1, designed specifically for financial sentiment analysis. It classifies financial texts into positive, negative, or neutral categories using a lightweight and efficient LoRA-based adaptation.
diwakartiwari/mistral-7b-financial-sentimentmistralai/Mistral-7B-v0.1from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("diwakartiwari/mistral-7b-financial-sentiment")
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")
model = PeftModel.from_pretrained(base_model, "diwakartiwari/mistral-7b-financial-sentiment")
# Prepare prompt
prompt = "<s>[INST] Analyze the financial sentiment of this statement: Company reported record profits [/INST] "
# Generate response
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# Expected Output: "The financial sentiment is positive."