Add comprehensive model card
Browse files
README.md
CHANGED
|
@@ -1,22 +1,170 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
tags:
|
| 4 |
-
- text-generation-inference
|
| 5 |
-
- transformers
|
| 6 |
-
- unsloth
|
| 7 |
-
- llama
|
| 8 |
-
- trl
|
| 9 |
-
license: apache-2.0
|
| 10 |
language:
|
| 11 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
license: llama3.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
+
tags:
|
| 6 |
+
- llama
|
| 7 |
+
- llama-3
|
| 8 |
+
- gguf
|
| 9 |
+
- quantized
|
| 10 |
+
- tax
|
| 11 |
+
- indian-law
|
| 12 |
+
- finance
|
| 13 |
+
base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
|
| 14 |
+
datasets:
|
| 15 |
+
- custom
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# Llama 3.1 8B - Indian Income Tax Act 1961 (GGUF)
|
| 20 |
+
|
| 21 |
+
Fine-tuned **Llama 3.1 8B Instruct** model specialized in the **Indian Income Tax Act 1961**. Optimized for tax law queries, compliance questions, and section references.
|
| 22 |
+
|
| 23 |
+
## 🎯 Model Details
|
| 24 |
+
|
| 25 |
+
- **Base Model**: [meta-llama/Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct)
|
| 26 |
+
- **Fine-tuning Method**: LoRA (r=64, alpha=64) with Unsloth
|
| 27 |
+
- **Training Date**: 20251201
|
| 28 |
+
- **Context Length**: 4096 tokens
|
| 29 |
+
- **Format**: GGUF (ready for llama.cpp, Ollama, LM Studio, Jan, etc.)
|
| 30 |
+
- **Specialization**: Indian Income Tax Act 1961
|
| 31 |
+
|
| 32 |
+
## 📦 Available Quantizations
|
| 33 |
+
|
| 34 |
+
| File | Size | Use Case | RAM Required | Quality |
|
| 35 |
+
|------|------|----------|--------------|---------|
|
| 36 |
+
| `q4_k_m` | ~4.5GB | **Recommended** - Best balance | 6-8GB | ⭐⭐⭐⭐ |
|
| 37 |
+
| `q5_k_m` | ~5.5GB | High quality responses | 8-10GB | ⭐⭐⭐⭐⭐ |
|
| 38 |
+
| `q8_0` | ~8GB | Near-original quality | 10-12GB | ⭐⭐⭐⭐⭐ |
|
| 39 |
+
| `f16` | ~15GB | Maximum quality (if available) | 18-20GB | ⭐⭐⭐⭐⭐ |
|
| 40 |
+
|
| 41 |
+
### Quantization Guide
|
| 42 |
+
- **q4_k_m**: Best for most users - good quality, reasonable size
|
| 43 |
+
- **q5_k_m**: Better quality with slight size increase
|
| 44 |
+
- **q8_0**: Minimal quality loss, larger file
|
| 45 |
+
- **f16**: Full precision, largest file
|
| 46 |
+
|
| 47 |
+
## 🚀 Quick Start
|
| 48 |
+
|
| 49 |
+
### Using Ollama
|
| 50 |
+
|
| 51 |
+
1. Download the model file (e.g., q4_k_m)
|
| 52 |
+
wget https://huggingface.co/teclabs/Llama-3.1-8b-Instruct-Ind-Tax-Act-1961_Optimal/resolve/main/llama-tax-act-q4_k_m.gguf
|
| 53 |
+
|
| 54 |
+
2. Create Modelfile
|
| 55 |
+
cat > Modelfile << 'EOF'
|
| 56 |
+
FROM ./llama-tax-act-q4_k_m.gguf
|
| 57 |
+
|
| 58 |
+
PARAMETER temperature 0.7
|
| 59 |
+
PARAMETER top_p 0.9
|
| 60 |
+
PARAMETER top_k 40
|
| 61 |
+
PARAMETER repeat_penalty 1.1
|
| 62 |
+
|
| 63 |
+
SYSTEM """You are an expert on the Indian Income Tax Act 1961.
|
| 64 |
+
Provide accurate, detailed information about tax regulations, exemptions,
|
| 65 |
+
deductions, and compliance requirements. Always cite relevant sections
|
| 66 |
+
when applicable."""
|
| 67 |
+
EOF
|
| 68 |
+
|
| 69 |
+
3. Create the model
|
| 70 |
+
ollama create llama-tax-act -f Modelfile
|
| 71 |
+
|
| 72 |
+
4. Run it
|
| 73 |
+
ollama run llama-tax-act
|
| 74 |
+
|
| 75 |
+
### Using llama.cpp
|
| 76 |
+
|
| 77 |
+
Download model
|
| 78 |
+
wget https://huggingface.co/teclabs/Llama-3.1-8b-Instruct-Ind-Tax-Act-1961_Optimal/resolve/main/llama-tax-act-q4_k_m.gguf
|
| 79 |
+
|
| 80 |
+
Run inference
|
| 81 |
+
./llama-cli -m llama-tax-act-q4_k_m.gguf -p "Explain Section 80C deductions:" -n 512
|
| 82 |
+
|
| 83 |
+
Download model
|
| 84 |
+
wget https://huggingface.co/teclabs/Llama-3.1-8b-Instruct-Ind-Tax-Act-1961_Optimal/resolve/main/llama-tax-act-q4_k_m.gguf
|
| 85 |
+
|
| 86 |
+
Run inference
|
| 87 |
+
./llama-cli -m llama-tax-act-q4_k_m.gguf -p "Explain Section 80C deductions:" -n 512
|
| 88 |
+
|
| 89 |
+
from llama_cpp import Llama
|
| 90 |
|
| 91 |
+
Load model
|
| 92 |
+
llm = Llama(
|
| 93 |
+
model_path="./llama-tax-act-q4_k_m.gguf",
|
| 94 |
+
n_ctx=4096,
|
| 95 |
+
n_threads=8,
|
| 96 |
+
n_gpu_layers=35 # Adjust based on your GPU
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
Generate response
|
| 100 |
+
output = llm(
|
| 101 |
+
"What are the tax implications under Section 54?",
|
| 102 |
+
max_tokens=512,
|
| 103 |
+
temperature=0.7,
|
| 104 |
+
top_p=0.9,
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
print(output['choices']['text'])
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
## 💡 Example Queries
|
| 111 |
+
|
| 112 |
+
Q: What are the deductions available under Chapter VI-A?
|
| 113 |
+
Q: Explain Section 80C and its limit for FY 2023-24
|
| 114 |
+
Q: What is the difference between Section 80C and 80D?
|
| 115 |
+
Q: How is capital gains tax calculated under Section 112A?
|
| 116 |
+
Q: What are the exemptions available under Section 10?
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
## 📊 Training Details
|
| 120 |
+
|
| 121 |
+
- **Training Hardware**: NVIDIA A100 80GB
|
| 122 |
+
- **Training Time**: ~8 minutes (including quantization)
|
| 123 |
+
- **Dataset**: Custom corpus from Income Tax Act 1961
|
| 124 |
+
- **Epochs**: Optimized for convergence
|
| 125 |
+
- **Learning Rate**: 2e-4 with cosine schedule
|
| 126 |
+
- **Precision**: BF16 training, quantized for deployment
|
| 127 |
+
|
| 128 |
+
## ⚙️ Technical Specifications
|
| 129 |
+
|
| 130 |
+
- **Architecture**: Llama 3.1 (8B parameters)
|
| 131 |
+
- **Vocabulary**: 128,256 tokens
|
| 132 |
+
- **Max Context**: 4096 tokens
|
| 133 |
+
- **Attention**: Grouped-Query Attention (GQA)
|
| 134 |
+
- **Activation**: SwiGLU
|
| 135 |
+
- **LoRA Rank**: 64 (higher than standard for better quality)
|
| 136 |
+
|
| 137 |
+
## 📈 Performance
|
| 138 |
+
|
| 139 |
+
- **Inference Speed** (q4_k_m on RTX 3090): ~40-50 tokens/sec
|
| 140 |
+
- **Inference Speed** (q4_k_m on M1 Max): ~25-35 tokens/sec
|
| 141 |
+
- **Quality**: Specialized responses with section references
|
| 142 |
+
|
| 143 |
+
## ⚠️ Limitations
|
| 144 |
+
|
| 145 |
+
- Trained on Income Tax Act 1961 as of training date (20251201)
|
| 146 |
+
- May not reflect latest amendments after this date
|
| 147 |
+
- Should be used as reference only, not legal advice
|
| 148 |
+
- Always verify with official sources
|
| 149 |
+
|
| 150 |
+
## 📜 License
|
| 151 |
+
|
| 152 |
+
This model inherits the [Llama 3.1 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE).
|
| 153 |
+
|
| 154 |
+
## ��� Acknowledgments
|
| 155 |
+
|
| 156 |
+
- **Meta AI** for Llama 3.1 base model
|
| 157 |
+
- **Unsloth AI** for efficient fine-tuning framework
|
| 158 |
+
- **ggerganov** for llama.cpp and GGUF format
|
| 159 |
+
|
| 160 |
+
## 📧 Contact
|
| 161 |
+
|
| 162 |
+
For questions or issues, please open an issue on the [repository](https://huggingface.co/teclabs/Llama-3.1-8b-Instruct-Ind-Tax-Act-1961_Optimal/discussions).
|
| 163 |
+
|
| 164 |
+
## 🔄 Updates
|
| 165 |
+
|
| 166 |
+
**2025-12-01**: Initial release with q4_k_m, q5_k_m, q8_0 quantizations
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
|
| 170 |
+
**Disclaimer**: This model is for educational and research purposes. Tax laws are complex and subject to change. Always consult qualified tax professionals for advice.
|