Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,32 +1,39 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
tags:
|
| 4 |
-
- finance
|
| 5 |
-
- tax
|
| 6 |
-
- banking
|
| 7 |
-
- investment
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
- π¦ Create and manage B2B invoices
|
| 21 |
-
- π Answer investment and banking queries
|
| 22 |
-
- β
Check financial document compliance
|
| 23 |
|
| 24 |
-
## π Try it
|
| 25 |
```python
|
| 26 |
from peft import PeftModel
|
| 27 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 28 |
import torch
|
| 29 |
|
|
|
|
| 30 |
base = AutoModelForCausalLM.from_pretrained(
|
| 31 |
"mistralai/Mistral-7B-v0.1",
|
| 32 |
torch_dtype=torch.float16,
|
|
@@ -35,21 +42,16 @@ base = AutoModelForCausalLM.from_pretrained(
|
|
| 35 |
model = PeftModel.from_pretrained(base, "webdpro/finxan")
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained("webdpro/finxan")
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7, do_sample=True)
|
| 42 |
-
full = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 43 |
-
return full.split("### Response:")[-1].strip()
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
```
|
| 48 |
|
| 49 |
-
##
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
**Finxan:** GST amount: Rs 13500. Total payable: Rs 88500.
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: mistralai/Mistral-7B-v0.1
|
| 3 |
+
library_name: peft
|
| 4 |
tags:
|
| 5 |
+
- finance
|
| 6 |
+
- tax
|
| 7 |
+
- banking
|
| 8 |
+
- investment
|
| 9 |
+
- qlora
|
| 10 |
+
- mistral
|
| 11 |
+
- indian-finance
|
| 12 |
+
- gst
|
| 13 |
+
license: apache-2.0
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# Finxan β Finance Domain LLM
|
| 17 |
|
| 18 |
+
Fine-tuned **Mistral-7B-v0.1** using QLoRA (4-bit) on Indian finance domain examples:
|
| 19 |
+
- π§Ύ GST / Tax compliance & calculations
|
| 20 |
+
- π¦ B2B Invoicing & banking
|
| 21 |
+
- π Investment advice
|
| 22 |
|
| 23 |
+
**Training details:**
|
| 24 |
+
- Hardware: Google Colab T4 GPU (free)
|
| 25 |
+
- Method: QLoRA 4-bit, LoRA r=16
|
| 26 |
+
- Epochs: 3
|
| 27 |
+
- Dataset: 110 finance instruction examples
|
| 28 |
|
| 29 |
+
## How to use
|
|
|
|
|
|
|
|
|
|
| 30 |
|
|
|
|
| 31 |
```python
|
| 32 |
from peft import PeftModel
|
| 33 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 34 |
import torch
|
| 35 |
|
| 36 |
+
# Load base + adapter
|
| 37 |
base = AutoModelForCausalLM.from_pretrained(
|
| 38 |
"mistralai/Mistral-7B-v0.1",
|
| 39 |
torch_dtype=torch.float16,
|
|
|
|
| 42 |
model = PeftModel.from_pretrained(base, "webdpro/finxan")
|
| 43 |
tokenizer = AutoTokenizer.from_pretrained("webdpro/finxan")
|
| 44 |
|
| 45 |
+
# Run inference
|
| 46 |
+
prompt = """### Instruction:
|
| 47 |
+
Calculate GST
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
### Input:
|
| 50 |
+
Invoice amount Rs 50000, GST rate 18%
|
|
|
|
| 51 |
|
| 52 |
+
### Response:"""
|
| 53 |
|
| 54 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 55 |
+
outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.7, do_sample=True)
|
| 56 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 57 |
+
```
|
|
|