YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Indian FinBERT β LoRA Fine-tuned Adapter
FinBERT (
ProsusAI/finbert) fine-tuned on Indian financial news headlines using LoRA adapters.
Optimised for Indian market sentiment β Nifty 50 stocks, NSE/BSE news, RBI announcements, and Indian business headlines. This repo contains the adapter files only .
The adapter is ~15 MB β not the full 440 MB model. You load it on top of the base ProsusAI/finbert model which is downloaded automatically from HuggingFace on first use.
Labels
| ID | Label | Meaning |
|---|---|---|
| 0 | POSITIVE | Bullish sentiment |
| 1 | NEGATIVE | Bearish sentiment |
| 2 | NEUTRAL | No clear directional signal |
Setup
1. Clone the repo and unzip the adapter
# Make sure git-xet is installed (https://hf.co/docs/hub/git-xet)
winget install git-xet
git clone https://huggingface.co/ArpitJha/Indian-FinBert-Adapters
Or just download the files and move them in a single folder for ease
2. Create a virtual environment
python -m venv .venv
# Linux / macOS
source .venv/bin/activate
# Windows
.venv\Scripts\activate
3. Install dependencies
pip install torch==2.6.0 transformers==4.47.0 peft==0.13.0 safetensors==0.4.3
Have an NVIDIA GPU? Install the CUDA build of torch for faster inference:
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124 pip install transformers==4.47.0 peft==0.13.0 safetensors==0.4.3
Option A β Quick inference with the adapter
Load the adapter on top of the frozen base model. This is the lightest approach β base model weights stay on disk, only the adapter is in memory on top.
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification,
pipeline
)
from peft import PeftModel
import torch
BASE_MODEL = "ProsusAI/finbert"
# Locally after downloading and unzipping the adapter files, we can load them using the path
ADAPTER_PATH = "YOUR_ADAPTER_FOLDER"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForSequenceClassification.from_pretrained(BASE_MODEL, num_labels=3)
model = PeftModel.from_pretrained(base_model, ADAPTER_PATH)
model = model.merge_and_unload()
model.eval()
nlp = pipeline(
"sentiment-analysis",
model = model,
tokenizer = tokenizer,
device = 0 if torch.cuda.is_available() else -1
)
label_map = {
"LABEL_0": "POSITIVE",
"LABEL_1": "NEGATIVE",
"LABEL_2": "NEUTRAL"
}
test_headlines = [
"Reliance Industries posts record quarterly profit.",
"Adani Group stocks crash amid fraud allegations.",
"RBI keeps interest rates unchanged in policy meeting.",
"Infosys wins $2 billion AI transformation deal.",
]
print("=" * 60)
print("FINBERT + LORA SENTIMENT ANALYSIS")
print("=" * 60)
for text in test_headlines:
result = nlp(text)[0]
sentiment = label_map.get(result["label"], result["label"])
print(f"\nHeadline : {text}")
print(f"Sentiment: {sentiment}")
print(f"Confidence: {result['score']:.4f}")
Requirements
torch>=2.6.0
transformers==4.47.0
peft==0.13.0
safetensors==0.4.3
pandas>=2.2.0 # only needed for batch CSV inference
Model details
| Property | Value |
|---|---|
| Base model | ProsusAI/finbert |
| Fine-tuning method | LoRA (PEFT) |
| LoRA rank | 32 |
| LoRA alpha | 64 |
| Target modules | query, value |
| Training data | Indian financial news headlines |
| Task | 3-class sentiment classification |
| Labels | Positive / Negative / Neutral |
| Trainable parameters | ~1% of total |
License
The adapter weights in this repository are released under the MIT License.
The base model (ProsusAI/finbert) is subject to its own Apache 2.0 license.
