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|
|
|
|
|
|
|
| 1 |
+
# π Nifty50GPT-Final β India's First Financial SQL LLM (Offline, Open-Source)
|
| 2 |
+
|
| 3 |
+
**Nifty50GPT-Final** is a lightweight, offline-ready transformer model trained on structured Indian stock market data.
|
| 4 |
+
It was created by [Shubham Sood](https://www.linkedin.com/in/shubhamsood1) at **Student One Private Limited** to make financial analysis transparent, free, and locally usable β without APIs or cloud dependencies.
|
| 5 |
+
|
| 6 |
+
This release includes:
|
| 7 |
+
- A fully fine-tuned language model that generates **SQL queries** on structured prompts
|
| 8 |
+
- A bundled DuckDB database (`student_data.duckdb`) for instant access to 10+ years of data across 50+ NIFTY stocks, Indian indices, and global indices
|
| 9 |
+
- Support for both CPU and GPU inference with zero dependencies on internet or live data
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## π¦ What's Included
|
| 14 |
+
|
| 15 |
+
| File | Description |
|
| 16 |
+
|---------------------------|-------------------------------------------------|
|
| 17 |
+
| `pytorch_model.bin` | Final trained LLM weights (TinyLLaMA-1.1B base) |
|
| 18 |
+
| `tokenizer.json` | Tokenizer configuration |
|
| 19 |
+
| `config.json` | Model configuration |
|
| 20 |
+
| `special_tokens_map.json` | Special token mapping |
|
| 21 |
+
| `student_data.duckdb` | Historical Indian financial data |
|
| 22 |
+
| `README.md` | You're reading it |
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## βοΈ How to Run (Inference on CPU or GPU)
|
| 27 |
+
|
| 28 |
+
### π₯οΈ Local Inference (CPU)
|
| 29 |
+
```python
|
| 30 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 31 |
+
import torch
|
| 32 |
+
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained("StudentOne/Nifty50GPT-Final")
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained("StudentOne/Nifty50GPT-Final")
|
| 35 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 36 |
+
|
| 37 |
+
prompt = "### Instruction: What was the net_profit of INFY on 2021-03-31?\n### Output:"
|
| 38 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 39 |
+
|
| 40 |
+
outputs = model.generate(
|
| 41 |
+
**inputs,
|
| 42 |
+
max_new_tokens=100,
|
| 43 |
+
do_sample=False,
|
| 44 |
+
pad_token_id=tokenizer.pad_token_id,
|
| 45 |
+
eos_token_id=tokenizer.eos_token_id
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
print(tokenizer.decode(outputs[0]))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
###DuckDB Integration (student_data.duckdb)
|
| 54 |
+
All responses from Nifty50GPT-Final are SQL-ready and designed to be run on student_data.duckdb.
|
| 55 |
+
|
| 56 |
+
πͺ How to Use It:
|
| 57 |
+
Download DuckDB
|
| 58 |
+
|
| 59 |
+
Launch DuckDB in terminal or PowerShell:
|
| 60 |
+
|
| 61 |
+
Paste the SQL query generated by the model, for example:
|
| 62 |
+
|
| 63 |
+
SELECT value FROM fundamentals
|
| 64 |
+
WHERE stock_symbol = 'INFY'
|
| 65 |
+
AND metric = 'net_profit'
|
| 66 |
+
AND date = DATE '2021-03-31';
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
β‘ Works instantly. No server, no latency, no setup.
|
| 70 |
+
You can extend the dataset while keeping the schema the same
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
### π What Can I Ask Nifty50-GPT?
|
| 74 |
+
|
| 75 |
+
1. Fundamental Metric Lookups
|
| 76 |
+
What was the net_profit of TCS on 2022-03-31?
|
| 77 |
+
Give me the EPS of INFY on 2023-03-31
|
| 78 |
+
|
| 79 |
+
2. All Fundamentals for a Company
|
| 80 |
+
|
| 81 |
+
Give me all fundamental metrics for RELIANCE on 2021-03-31
|
| 82 |
+
|
| 83 |
+
3. Year-over-Year Growth
|
| 84 |
+
|
| 85 |
+
What was the YoY growth of net_profit for HDFCBANK?
|
| 86 |
+
|
| 87 |
+
4. CAGR
|
| 88 |
+
|
| 89 |
+
What was the 5-year CAGR of EPS for INFY from 2017 to 2022?
|
| 90 |
+
|
| 91 |
+
5. OHLCV for Stocks or Indices
|
| 92 |
+
|
| 93 |
+
Give me OHLCV for ASIANPAINT on 2023-01-20
|
| 94 |
+
What was the close price of NIFTY50 on 2022-12-12?
|
| 95 |
+
|
| 96 |
+
6. Rolling Metrics
|
| 97 |
+
|
| 98 |
+
What was the 30-day moving average of close price for INFY on 2023-03-15?
|
| 99 |
+
|
| 100 |
+
7. NIFTY-Wide Aggregates
|
| 101 |
+
|
| 102 |
+
What was the average ROE across all NIFTY50 companies in 2022?
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# Supported Stock Symbols
|
| 106 |
+
# Use stock symbols, not full company names. Examples:
|
| 107 |
+
|
| 108 |
+
INFY, TCS, RELIANCE, HDFCBANK, ITC, ASIANPAINT, WIPRO,
|
| 109 |
+
KOTAKBANK, ADANIENT, SBIN, LT, TECHM, COALINDIA, NESTLEIND
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
indian indices-
|
| 113 |
+
NIFTY50, SENSEX, NSEBANK, CNXIT, CNXPHARMA,
|
| 114 |
+
CNXMEDIA, CNXENERGY, CNXAUTO, CNXMETAL, CNXREALTY
|
| 115 |
+
|
| 116 |
+
global indices-
|
| 117 |
+
S&P 500, Nasdaq 100, Dow Jones, FTSE 100,
|
| 118 |
+
DAX, Nikkei 225, Hang Seng, Shanghai Composite
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
π
Supported Date Format
|
| 122 |
+
|
| 123 |
+
YYYY-03-31 - all yearly fundamentals have been shown to be reported on 31st of every march
|
| 124 |
+
|
| 125 |
+
YYYY-MM-DD for the rest
|
| 126 |
+
|
| 127 |
+
β οΈ Tips to Avoid Hallucination
|
| 128 |
+
Use exact stock symbols (INFY, not Infosys)
|
| 129 |
+
|
| 130 |
+
Use supported metric names and date formats
|
| 131 |
+
|
| 132 |
+
Follow the formats in this README for best results
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## β οΈ Legal Disclaimer
|
| 138 |
+
|
| 139 |
+
This model and its associated database are provided **strictly for research, experimentation, and educational purposes** only.
|
| 140 |
+
|
| 141 |
+
- **Nifty50GPT-Final does not provide financial advice.**
|
| 142 |
+
- It does not guarantee accuracy, completeness, or relevance of any output.
|
| 143 |
+
- It should not be used to make or inform investment decisions.
|
| 144 |
+
- Outputs may be outdated, incorrect, or misinterpreted if used outside the documented prompt structure.
|
| 145 |
+
- The included `student_data.duckdb` file is a static, sample database and may not reflect the most current financial data.
|
| 146 |
+
|
| 147 |
+
### π No Liability
|
| 148 |
+
|
| 149 |
+
By using this model or dataset:
|
| 150 |
+
- You acknowledge that **all responsibility lies with the user**.
|
| 151 |
+
- Neither the author(s), contributors, nor affiliated organizations shall be held liable for any outcome, financial or otherwise, resulting from the use or misuse of this model or its outputs.
|
| 152 |
+
|
| 153 |
+
This project is **not affiliated with the NSE, SEBI, or any regulatory or financial institution.**
|
| 154 |
+
This model is **not certified**, **audited**, or **approved** by any authority.
|
| 155 |
+
|
| 156 |
+
> Use responsibly. Fork freely. Trust nothing. Verify everything.
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
π¨βπΌ Credits
|
| 160 |
+
Created by Shubham Sood
|
| 161 |
+
Maintained by Student One Private Limited
|
| 162 |
+
π www.studentone.tech
|
| 163 |
+
π§ Trained with β€οΈ to make financial knowledge open, not gated.
|
| 164 |
+
|