初始化项目,由ModelHub XC社区提供模型
Model: kartikey31/txn-parser Source: Original Platform
This commit is contained in:
68
.gitattributes
vendored
Normal file
68
.gitattributes
vendored
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
teacher/adapters/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
teacher/checkpoints/checkpoint-400/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
teacher/checkpoints/checkpoint-507/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
teacher/gguf/gemma-4-e2b-it.BF16-mmproj.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
teacher/gguf/gemma-4-e2b-it.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/adapters/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/checkpoints/checkpoint-468/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma-3-270m-it.BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma-3-270m-it.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma-3-270m-it.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma-3-270m-it.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma-3-270m-it.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma3_text-fixed.BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma3_text-fixed.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma3_text-fixed.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
student/gguf/gemma3_text-fixed.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/adapters/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/adapters/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
152
README.md
Normal file
152
README.md
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
tags:
|
||||||
|
- text-generation
|
||||||
|
- lora
|
||||||
|
- qlora
|
||||||
|
- gguf
|
||||||
|
- transaction-parser
|
||||||
|
- on-device
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
- hi
|
||||||
|
library_name: peft
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
---
|
||||||
|
|
||||||
|
# txn-parser
|
||||||
|
|
||||||
|
QLoRA fine-tunes of three small base models for extracting structured
|
||||||
|
transaction data (amount, currency, item, category, type) from free-form
|
||||||
|
Indian-English / code-switched speech and text. Trained on the same
|
||||||
|
93k-row teacher-labeled dataset, validator-gated, and quantized to 5 GGUF
|
||||||
|
tiers each.
|
||||||
|
|
||||||
|
This repo holds **all three published students in side-by-side
|
||||||
|
subfolders** so a downstream app can pick its size/quality tradeoff:
|
||||||
|
|
||||||
|
| Base model | Subfolder | Params | Best on-device pick |
|
||||||
|
|---|---|---:|---|
|
||||||
|
| `unsloth/gemma-3-270m-it` | [`gemma-3-270m/`](./tree/main/gemma-3-270m) | 270M | `Q5_K_M` (260 MB, 99.7% schema) |
|
||||||
|
| `HuggingFaceTB/SmolLM2-360M-Instruct` | [`smollm2-360m/`](./tree/main/smollm2-360m) | 360M | `Q4_K_M` (271 MB, 100% schema) |
|
||||||
|
| `Qwen/Qwen3-0.6B` | [`qwen3-0.6b/`](./tree/main/qwen3-0.6b) | 600M | `Q4_K_M` (397 MB, 100% schema, **best exact match**) |
|
||||||
|
|
||||||
|
Each subfolder contains:
|
||||||
|
|
||||||
|
```
|
||||||
|
<short>/
|
||||||
|
├── adapters/ # PEFT LoRA adapter (load on top of base)
|
||||||
|
│ ├── adapter_config.json
|
||||||
|
│ └── adapter_model.safetensors
|
||||||
|
├── gguf/ # 5 merged quantizations, ship-ready
|
||||||
|
│ ├── txn-parser-<short>-F16.gguf
|
||||||
|
│ ├── txn-parser-<short>-Q8_0.gguf
|
||||||
|
│ ├── txn-parser-<short>-Q6_K.gguf
|
||||||
|
│ ├── txn-parser-<short>-Q5_K_M.gguf
|
||||||
|
│ └── txn-parser-<short>-Q4_K_M.gguf
|
||||||
|
└── README.md # model card with the exact SYSTEM_PROMPT
|
||||||
|
```
|
||||||
|
|
||||||
|
## Eval (300-example held-out set, grammar-constrained decoding)
|
||||||
|
|
||||||
|
| Model | Quant | Size | JSON valid | Schema valid | Exact match | Amount exact | Mean ms |
|
||||||
|
|---|---|---:|---:|---:|---:|---:|---:|
|
||||||
|
| gemma-3-270m | Q5_K_M | 260 MB | 99.7% | **99.7%** | 51.0% | 84.7% | 1788 |
|
||||||
|
| gemma-3-270m | Q4_K_M | 253 MB | 93.3% | 93.3% | 48.3% | 80.7% | 2660 |
|
||||||
|
| smollm2-360m | Q5_K_M | 290 MB | 100.0% | **100.0%** | 52.7% | 89.0% | 996 |
|
||||||
|
| smollm2-360m | Q4_K_M | 271 MB | 100.0% | **100.0%** | 53.3% | 87.3% | 978 |
|
||||||
|
| qwen3-0.6b | Q5_K_M | 444 MB | 100.0% | **100.0%** | 60.0% | 91.3% | 857 |
|
||||||
|
| qwen3-0.6b | Q4_K_M | 397 MB | 100.0% | **100.0%** | 60.0% | 90.7% | 885 |
|
||||||
|
|
||||||
|
(Showing Q5_K_M + Q4_K_M only — full 15-row table for all 5 quants is in
|
||||||
|
the source repo's `eval_results/REPORT.md`.)
|
||||||
|
|
||||||
|
**Recommendations:**
|
||||||
|
|
||||||
|
- **Best accuracy on-device:** `qwen3-0.6b-Q4_K_M` (397 MB, 60% exact, ~885 ms)
|
||||||
|
- **Smallest ship size:** `smollm2-360m-Q4_K_M` (271 MB, 53% exact, ~978 ms)
|
||||||
|
- **Lowest latency:** `qwen3-0.6b-Q8_0` (639 MB, 59% exact, ~851 ms)
|
||||||
|
- **Avoid:** `gemma-3-270m-Q4_K_M` — quality cliff vs Q5_K_M (93% → 99.7% schema)
|
||||||
|
|
||||||
|
## Quick download
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Just one quant of one model (small)
|
||||||
|
huggingface-cli download kartikey31/txn-parser \
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf --local-dir .
|
||||||
|
|
||||||
|
# Everything (3 models × 5 quants, ~5 GB)
|
||||||
|
huggingface-cli download kartikey31/txn-parser --local-dir ./txn-parser
|
||||||
|
```
|
||||||
|
|
||||||
|
Or from Python:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from huggingface_hub import hf_hub_download
|
||||||
|
|
||||||
|
gguf = hf_hub_download(
|
||||||
|
"kartikey31/txn-parser",
|
||||||
|
"qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf",
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (llama-cpp-python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
# Same SYSTEM_PROMPT for ALL three models — they were trained with it.
|
||||||
|
SYSTEM_PROMPT = """You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health."""
|
||||||
|
|
||||||
|
llm = Llama(
|
||||||
|
model_path="txn-parser-qwen3-0.6b-Q4_K_M.gguf",
|
||||||
|
n_gpu_layers=-1, n_ctx=1024,
|
||||||
|
)
|
||||||
|
out = llm.create_chat_completion(messages=[
|
||||||
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
|
{"role": "user", "content": "200 ka samosa and 50 chai"},
|
||||||
|
], temperature=0.0)
|
||||||
|
print(out["choices"][0]["message"]["content"])
|
||||||
|
# {"transactions":[{"amount":200,"currency":"INR","item":"samosa",...}, ...]}
|
||||||
|
```
|
||||||
|
|
||||||
|
For Android / on-device deployment guidance (recommended llama.cpp
|
||||||
|
params, battery checklist, Kotlin POC), see the [training pipeline
|
||||||
|
README](https://github.com/kartikeychoudhary/txn-parser#android-deployment).
|
||||||
|
|
||||||
|
## Training pipeline
|
||||||
|
|
||||||
|
Full reproduction pipeline (data generation → teacher training →
|
||||||
|
distillation → multi-model student training → multi-quant export → eval
|
||||||
|
report) lives at
|
||||||
|
[`github.com/kartikeychoudhary/txn-parser`](https://github.com/kartikeychoudhary/txn-parser).
|
||||||
|
|
||||||
|
A single command reproduces all three models from a fresh checkout:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/kartikeychoudhary/txn-parser
|
||||||
|
cd txn-parser
|
||||||
|
bash setup.sh
|
||||||
|
python scripts/05_generate_distillation_data.py --phase eval --force-eval-copy
|
||||||
|
python scripts/train_and_publish.py # trains gemma, smollm, qwen; publishes here
|
||||||
|
python scripts/eval_all_quants.py # regenerates the eval table
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Apache 2.0 (matches all three base model licenses).
|
||||||
152
gemma-3-270m/README.md
Normal file
152
gemma-3-270m/README.md
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: unsloth/gemma-3-270m-it
|
||||||
|
tags:
|
||||||
|
- text-generation
|
||||||
|
- lora
|
||||||
|
- qlora
|
||||||
|
- gguf
|
||||||
|
- transaction-parser
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
- hi
|
||||||
|
library_name: peft
|
||||||
|
---
|
||||||
|
|
||||||
|
# txn-parser / gemma-3-270m
|
||||||
|
|
||||||
|
QLoRA fine-tune of [`unsloth/gemma-3-270m-it`](https://huggingface.co/unsloth/gemma-3-270m-it) for
|
||||||
|
extracting structured transaction data (amount, currency, item, category,
|
||||||
|
type) from free-form Indian-English / code-switched speech and text.
|
||||||
|
|
||||||
|
This model lives in subfolder **`gemma-3-270m/`** of the
|
||||||
|
[`kartikey31/txn-parser`](https://huggingface.co/kartikey31/txn-parser) repo, alongside
|
||||||
|
sibling fine-tunes of other base models trained on the same data.
|
||||||
|
|
||||||
|
## What's in here
|
||||||
|
|
||||||
|
- `gemma-3-270m/adapters/` — PEFT LoRA adapter (rank 32). Load on top of the base model
|
||||||
|
with `peft.PeftModel.from_pretrained(base, "kartikey31/txn-parser", subfolder="gemma-3-270m/adapters")`.
|
||||||
|
- `gemma-3-270m/gguf/` — merged GGUF builds at multiple quantization levels
|
||||||
|
(file names follow `txn-parser-gemma-3-270m-<QUANT>.gguf`):
|
||||||
|
- [`gemma-3-270m/gguf/txn-parser-gemma-3-270m-F16.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/gemma-3-270m/gguf/txn-parser-gemma-3-270m-F16.gguf) (542.8 MB)
|
||||||
|
- [`gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf) (253.1 MB)
|
||||||
|
- [`gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q5_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q5_K_M.gguf) (260.0 MB)
|
||||||
|
- [`gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q6_K.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q6_K.gguf) (283.0 MB)
|
||||||
|
- [`gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q8_0.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q8_0.gguf) (291.5 MB)
|
||||||
|
|
||||||
|
## Training data
|
||||||
|
|
||||||
|
- 93,348 teacher-labeled examples (`data/distill/train.jsonl`)
|
||||||
|
- 300 held-out eval examples (`data/distill/eval.jsonl`)
|
||||||
|
- Validator-gated: every row's `output` passes the project's grammar +
|
||||||
|
amount-parser semantic validator.
|
||||||
|
|
||||||
|
## Training config
|
||||||
|
|
||||||
|
| Knob | Value |
|
||||||
|
|---|---|
|
||||||
|
| Base model | `unsloth/gemma-3-270m-it` |
|
||||||
|
| Method | QLoRA (4-bit) via Unsloth |
|
||||||
|
| LoRA rank | 32 (alpha 64, dropout 0.0) |
|
||||||
|
| Epochs | 2 |
|
||||||
|
| Batch size (train) | 64 |
|
||||||
|
| Grad accumulation | 1 |
|
||||||
|
| Eval batch size | 4 |
|
||||||
|
| Max seq length | 1024 |
|
||||||
|
| Learning rate | 2e-4 (warmup 3%) |
|
||||||
|
| Started | |
|
||||||
|
| Finished | |
|
||||||
|
|
||||||
|
## System prompt (use this EXACTLY)
|
||||||
|
|
||||||
|
The model was trained with one specific system prompt and Gemma/Smol/Qwen
|
||||||
|
chat template. If you paraphrase the prompt or skip the chat template,
|
||||||
|
quality degrades quickly. Copy-paste this verbatim into your inference
|
||||||
|
client (no leading/trailing whitespace, no edits):
|
||||||
|
|
||||||
|
```text
|
||||||
|
You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.
|
||||||
|
```
|
||||||
|
|
||||||
|
Source of truth: [`scripts/_lib.py`](https://github.com/kartikeychoudhary/txn-parser/blob/main/scripts/_lib.py)
|
||||||
|
constant `SYSTEM_PROMPT`. Don't retype it — pull from `_lib.py` or this README.
|
||||||
|
|
||||||
|
## Download a single GGUF
|
||||||
|
|
||||||
|
```bash
|
||||||
|
huggingface-cli download kartikey31/txn-parser \
|
||||||
|
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf \
|
||||||
|
--local-dir .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (Python, llama-cpp-python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
SYSTEM_PROMPT = '''You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.'''
|
||||||
|
|
||||||
|
llm = Llama(
|
||||||
|
model_path="txn-parser-gemma-3-270m-Q4_K_M.gguf",
|
||||||
|
n_gpu_layers=-1, n_ctx=2048,
|
||||||
|
)
|
||||||
|
out = llm.create_chat_completion(
|
||||||
|
messages=[
|
||||||
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
|
{"role": "user", "content": "200 ka samosa"},
|
||||||
|
],
|
||||||
|
temperature=0.0,
|
||||||
|
)
|
||||||
|
print(out["choices"][0]["message"]["content"])
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (CLI, llama.cpp)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./llama-cli -m txn-parser-gemma-3-270m-Q4_K_M.gguf \
|
||||||
|
--grammar-file scripts/grammar.gbnf \
|
||||||
|
--system-prompt "$(cat system_prompt.txt)" \
|
||||||
|
-p "200 ka samosa" -n 256
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reproduce
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/kartikeychoudhary/txn-parser.git
|
||||||
|
cd txn-parser && bash setup.sh
|
||||||
|
python scripts/train_and_publish.py --only gemma-3-270m
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
*Auto-published by `scripts/train_and_publish.py` on 2026-05-22T21:33:31.274220+00:00.*
|
||||||
210
gemma-3-270m/adapters/README.md
Normal file
210
gemma-3-270m/adapters/README.md
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
---
|
||||||
|
base_model: unsloth/gemma-3-270m-it-unsloth-bnb-4bit
|
||||||
|
library_name: peft
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
tags:
|
||||||
|
- base_model:adapter:unsloth/gemma-3-270m-it-unsloth-bnb-4bit
|
||||||
|
- lora
|
||||||
|
- sft
|
||||||
|
- transformers
|
||||||
|
- trl
|
||||||
|
- unsloth
|
||||||
|
---
|
||||||
|
|
||||||
|
# Model Card for Model ID
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
### Model Description
|
||||||
|
|
||||||
|
<!-- Provide a longer summary of what this model is. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- **Developed by:** [More Information Needed]
|
||||||
|
- **Funded by [optional]:** [More Information Needed]
|
||||||
|
- **Shared by [optional]:** [More Information Needed]
|
||||||
|
- **Model type:** [More Information Needed]
|
||||||
|
- **Language(s) (NLP):** [More Information Needed]
|
||||||
|
- **License:** [More Information Needed]
|
||||||
|
- **Finetuned from model [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
### Model Sources [optional]
|
||||||
|
|
||||||
|
<!-- Provide the basic links for the model. -->
|
||||||
|
|
||||||
|
- **Repository:** [More Information Needed]
|
||||||
|
- **Paper [optional]:** [More Information Needed]
|
||||||
|
- **Demo [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
## Uses
|
||||||
|
|
||||||
|
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
||||||
|
|
||||||
|
### Direct Use
|
||||||
|
|
||||||
|
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Downstream Use [optional]
|
||||||
|
|
||||||
|
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Out-of-Scope Use
|
||||||
|
|
||||||
|
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Bias, Risks, and Limitations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Recommendations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
||||||
|
|
||||||
|
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
||||||
|
|
||||||
|
## How to Get Started with the Model
|
||||||
|
|
||||||
|
Use the code below to get started with the model.
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Training Details
|
||||||
|
|
||||||
|
### Training Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Training Procedure
|
||||||
|
|
||||||
|
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
||||||
|
|
||||||
|
#### Preprocessing [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
|
||||||
|
#### Training Hyperparameters
|
||||||
|
|
||||||
|
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
||||||
|
|
||||||
|
#### Speeds, Sizes, Times [optional]
|
||||||
|
|
||||||
|
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Evaluation
|
||||||
|
|
||||||
|
<!-- This section describes the evaluation protocols and provides the results. -->
|
||||||
|
|
||||||
|
### Testing Data, Factors & Metrics
|
||||||
|
|
||||||
|
#### Testing Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card if possible. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Factors
|
||||||
|
|
||||||
|
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Results
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Examination [optional]
|
||||||
|
|
||||||
|
<!-- Relevant interpretability work for the model goes here -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Environmental Impact
|
||||||
|
|
||||||
|
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
||||||
|
|
||||||
|
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
||||||
|
|
||||||
|
- **Hardware Type:** [More Information Needed]
|
||||||
|
- **Hours used:** [More Information Needed]
|
||||||
|
- **Cloud Provider:** [More Information Needed]
|
||||||
|
- **Compute Region:** [More Information Needed]
|
||||||
|
- **Carbon Emitted:** [More Information Needed]
|
||||||
|
|
||||||
|
## Technical Specifications [optional]
|
||||||
|
|
||||||
|
### Model Architecture and Objective
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Compute Infrastructure
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Hardware
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Software
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Citation [optional]
|
||||||
|
|
||||||
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||||
|
|
||||||
|
**BibTeX:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
**APA:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Glossary [optional]
|
||||||
|
|
||||||
|
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## More Information [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Authors [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Contact
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
### Framework versions
|
||||||
|
|
||||||
|
- PEFT 0.19.1
|
||||||
52
gemma-3-270m/adapters/adapter_config.json
Normal file
52
gemma-3-270m/adapters/adapter_config.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"alora_invocation_tokens": null,
|
||||||
|
"alpha_pattern": {},
|
||||||
|
"arrow_config": null,
|
||||||
|
"auto_mapping": {
|
||||||
|
"base_model_class": "Gemma3ForCausalLM",
|
||||||
|
"parent_library": "transformers.models.gemma3.modeling_gemma3",
|
||||||
|
"unsloth_fixed": true
|
||||||
|
},
|
||||||
|
"base_model_name_or_path": "unsloth/gemma-3-270m-it-unsloth-bnb-4bit",
|
||||||
|
"bias": "none",
|
||||||
|
"corda_config": null,
|
||||||
|
"ensure_weight_tying": false,
|
||||||
|
"eva_config": null,
|
||||||
|
"exclude_modules": null,
|
||||||
|
"fan_in_fan_out": false,
|
||||||
|
"inference_mode": true,
|
||||||
|
"init_lora_weights": true,
|
||||||
|
"layer_replication": null,
|
||||||
|
"layers_pattern": null,
|
||||||
|
"layers_to_transform": null,
|
||||||
|
"loftq_config": {},
|
||||||
|
"lora_alpha": 64,
|
||||||
|
"lora_bias": false,
|
||||||
|
"lora_dropout": 0.0,
|
||||||
|
"lora_ga_config": null,
|
||||||
|
"megatron_config": null,
|
||||||
|
"megatron_core": "megatron.core",
|
||||||
|
"modules_to_save": null,
|
||||||
|
"peft_type": "LORA",
|
||||||
|
"peft_version": "0.19.1",
|
||||||
|
"qalora_group_size": 16,
|
||||||
|
"r": 32,
|
||||||
|
"rank_pattern": {},
|
||||||
|
"revision": null,
|
||||||
|
"target_modules": [
|
||||||
|
"v_proj",
|
||||||
|
"down_proj",
|
||||||
|
"gate_proj",
|
||||||
|
"k_proj",
|
||||||
|
"o_proj",
|
||||||
|
"q_proj",
|
||||||
|
"up_proj"
|
||||||
|
],
|
||||||
|
"target_parameters": null,
|
||||||
|
"task_type": "CAUSAL_LM",
|
||||||
|
"trainable_token_indices": null,
|
||||||
|
"use_bdlora": null,
|
||||||
|
"use_dora": false,
|
||||||
|
"use_qalora": false,
|
||||||
|
"use_rslora": false
|
||||||
|
}
|
||||||
3
gemma-3-270m/adapters/adapter_model.safetensors
Normal file
3
gemma-3-270m/adapters/adapter_model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:45b973b84902da8d42103cebe35f1fd7ccd477e0ac8b65edd5cc01e86962f015
|
||||||
|
size 30409120
|
||||||
50
gemma-3-270m/adapters/chat_template.jinja
Normal file
50
gemma-3-270m/adapters/chat_template.jinja
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{# Unsloth Chat template fixes #}
|
||||||
|
{{ bos_token }}
|
||||||
|
{%- if messages[0]['role'] == 'system' -%}
|
||||||
|
{%- if messages[0]['content'] is string -%}
|
||||||
|
{%- set first_user_prefix = messages[0]['content'] + '
|
||||||
|
|
||||||
|
' -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
|
||||||
|
|
||||||
|
' -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- set loop_messages = messages[1:] -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set first_user_prefix = "" -%}
|
||||||
|
{%- set loop_messages = messages -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- for message in loop_messages -%}
|
||||||
|
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
|
||||||
|
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if (message['role'] == 'assistant') -%}
|
||||||
|
{%- set role = "model" -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set role = message['role'] -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{{ '<start_of_turn>' + role + '
|
||||||
|
' + (first_user_prefix if loop.first else "") }}
|
||||||
|
{%- if message['content'] is string -%}
|
||||||
|
{{ message['content'] | trim }}
|
||||||
|
{%- elif message['content'] is iterable -%}
|
||||||
|
{%- for item in message['content'] -%}
|
||||||
|
{%- if item['type'] == 'image' -%}
|
||||||
|
{{ '<start_of_image>' }}
|
||||||
|
{%- elif item['type'] == 'text' -%}
|
||||||
|
{{ item['text'] | trim }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- elif message['content'] is defined -%}
|
||||||
|
{{ raise_exception("Invalid content type") }}
|
||||||
|
{%- endif -%}
|
||||||
|
{{ '<end_of_turn>
|
||||||
|
' }}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- if add_generation_prompt -%}
|
||||||
|
{{'<start_of_turn>model
|
||||||
|
'}}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{# Copyright 2025-present Unsloth. Apache 2.0 License. #}
|
||||||
3
gemma-3-270m/adapters/tokenizer.json
Normal file
3
gemma-3-270m/adapters/tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:daab2354f8a74e70d70b4d1f804939b68a8c9624dd06cb7858e52dd8970e9726
|
||||||
|
size 33384567
|
||||||
3
gemma-3-270m/adapters/tokenizer.model
Normal file
3
gemma-3-270m/adapters/tokenizer.model
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
|
||||||
|
size 4689074
|
||||||
51346
gemma-3-270m/adapters/tokenizer_config.json
Normal file
51346
gemma-3-270m/adapters/tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-F16.gguf
Normal file
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:68d695f4376c7e60e1ebbffd39ec241e4ba713fe0214fd0a807e1aef7d303cbb
|
||||||
|
size 542835136
|
||||||
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf
Normal file
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b712099c6e1a1d96c02925983b5552297686054dfd38055d126596587168f95a
|
||||||
|
size 253114816
|
||||||
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q5_K_M.gguf
Normal file
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8f6998034ce51ce7227621930e95b0970a667e2eedb8aec04a18745ee9bbbffb
|
||||||
|
size 260026816
|
||||||
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q6_K.gguf
Normal file
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q6_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:44d85853e661a49e49be8177577431c98e2940951c98239b6e80b855fa3391c8
|
||||||
|
size 282974656
|
||||||
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q8_0.gguf
Normal file
3
gemma-3-270m/gguf/txn-parser-gemma-3-270m-Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:63f2d561d816946561952bacb8f076d60e622cf36995c5fd988a930475da95d7
|
||||||
|
size 291545536
|
||||||
152
qwen3-0.6b/README.md
Normal file
152
qwen3-0.6b/README.md
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: Qwen/Qwen3-0.6B
|
||||||
|
tags:
|
||||||
|
- text-generation
|
||||||
|
- lora
|
||||||
|
- qlora
|
||||||
|
- gguf
|
||||||
|
- transaction-parser
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
- hi
|
||||||
|
library_name: peft
|
||||||
|
---
|
||||||
|
|
||||||
|
# txn-parser / qwen3-0.6b
|
||||||
|
|
||||||
|
QLoRA fine-tune of [`Qwen/Qwen3-0.6B`](https://huggingface.co/Qwen/Qwen3-0.6B) for
|
||||||
|
extracting structured transaction data (amount, currency, item, category,
|
||||||
|
type) from free-form Indian-English / code-switched speech and text.
|
||||||
|
|
||||||
|
This model lives in subfolder **`qwen3-0.6b/`** of the
|
||||||
|
[`kartikey31/txn-parser`](https://huggingface.co/kartikey31/txn-parser) repo, alongside
|
||||||
|
sibling fine-tunes of other base models trained on the same data.
|
||||||
|
|
||||||
|
## What's in here
|
||||||
|
|
||||||
|
- `qwen3-0.6b/adapters/` — PEFT LoRA adapter (rank 32). Load on top of the base model
|
||||||
|
with `peft.PeftModel.from_pretrained(base, "kartikey31/txn-parser", subfolder="qwen3-0.6b/adapters")`.
|
||||||
|
- `qwen3-0.6b/gguf/` — merged GGUF builds at multiple quantization levels
|
||||||
|
(file names follow `txn-parser-qwen3-0.6b-<QUANT>.gguf`):
|
||||||
|
- [`qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-F16.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-F16.gguf) (1198.2 MB)
|
||||||
|
- [`qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf) (396.7 MB)
|
||||||
|
- [`qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q5_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q5_K_M.gguf) (444.4 MB)
|
||||||
|
- [`qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q6_K.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q6_K.gguf) (495.1 MB)
|
||||||
|
- [`qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q8_0.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q8_0.gguf) (639.4 MB)
|
||||||
|
|
||||||
|
## Training data
|
||||||
|
|
||||||
|
- 93,348 teacher-labeled examples (`data/distill/train.jsonl`)
|
||||||
|
- 300 held-out eval examples (`data/distill/eval.jsonl`)
|
||||||
|
- Validator-gated: every row's `output` passes the project's grammar +
|
||||||
|
amount-parser semantic validator.
|
||||||
|
|
||||||
|
## Training config
|
||||||
|
|
||||||
|
| Knob | Value |
|
||||||
|
|---|---|
|
||||||
|
| Base model | `Qwen/Qwen3-0.6B` |
|
||||||
|
| Method | QLoRA (4-bit) via Unsloth |
|
||||||
|
| LoRA rank | 32 (alpha 64, dropout 0.0) |
|
||||||
|
| Epochs | 2 |
|
||||||
|
| Batch size (train) | 64 |
|
||||||
|
| Grad accumulation | 2 |
|
||||||
|
| Eval batch size | 16 |
|
||||||
|
| Max seq length | 1024 |
|
||||||
|
| Learning rate | 2e-4 (warmup 3%) |
|
||||||
|
| Started | 2026-05-22T21:54:03.967900+00:00 |
|
||||||
|
| Finished | 2026-05-22T22:42:56.089528+00:00 |
|
||||||
|
|
||||||
|
## System prompt (use this EXACTLY)
|
||||||
|
|
||||||
|
The model was trained with one specific system prompt and Gemma/Smol/Qwen
|
||||||
|
chat template. If you paraphrase the prompt or skip the chat template,
|
||||||
|
quality degrades quickly. Copy-paste this verbatim into your inference
|
||||||
|
client (no leading/trailing whitespace, no edits):
|
||||||
|
|
||||||
|
```text
|
||||||
|
You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.
|
||||||
|
```
|
||||||
|
|
||||||
|
Source of truth: [`scripts/_lib.py`](https://github.com/kartikeychoudhary/txn-parser/blob/main/scripts/_lib.py)
|
||||||
|
constant `SYSTEM_PROMPT`. Don't retype it — pull from `_lib.py` or this README.
|
||||||
|
|
||||||
|
## Download a single GGUF
|
||||||
|
|
||||||
|
```bash
|
||||||
|
huggingface-cli download kartikey31/txn-parser \
|
||||||
|
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf \
|
||||||
|
--local-dir .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (Python, llama-cpp-python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
SYSTEM_PROMPT = '''You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.'''
|
||||||
|
|
||||||
|
llm = Llama(
|
||||||
|
model_path="txn-parser-qwen3-0.6b-Q4_K_M.gguf",
|
||||||
|
n_gpu_layers=-1, n_ctx=2048,
|
||||||
|
)
|
||||||
|
out = llm.create_chat_completion(
|
||||||
|
messages=[
|
||||||
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
|
{"role": "user", "content": "200 ka samosa"},
|
||||||
|
],
|
||||||
|
temperature=0.0,
|
||||||
|
)
|
||||||
|
print(out["choices"][0]["message"]["content"])
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (CLI, llama.cpp)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./llama-cli -m txn-parser-qwen3-0.6b-Q4_K_M.gguf \
|
||||||
|
--grammar-file scripts/grammar.gbnf \
|
||||||
|
--system-prompt "$(cat system_prompt.txt)" \
|
||||||
|
-p "200 ka samosa" -n 256
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reproduce
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/kartikeychoudhary/txn-parser.git
|
||||||
|
cd txn-parser && bash setup.sh
|
||||||
|
python scripts/train_and_publish.py --only qwen3-0.6b
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
*Auto-published by `scripts/train_and_publish.py` on 2026-05-22T22:42:56.387243+00:00.*
|
||||||
210
qwen3-0.6b/adapters/README.md
Normal file
210
qwen3-0.6b/adapters/README.md
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
---
|
||||||
|
base_model: unsloth/qwen3-0.6b-unsloth-bnb-4bit
|
||||||
|
library_name: peft
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
tags:
|
||||||
|
- base_model:adapter:unsloth/qwen3-0.6b-unsloth-bnb-4bit
|
||||||
|
- lora
|
||||||
|
- sft
|
||||||
|
- transformers
|
||||||
|
- trl
|
||||||
|
- unsloth
|
||||||
|
---
|
||||||
|
|
||||||
|
# Model Card for Model ID
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
### Model Description
|
||||||
|
|
||||||
|
<!-- Provide a longer summary of what this model is. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- **Developed by:** [More Information Needed]
|
||||||
|
- **Funded by [optional]:** [More Information Needed]
|
||||||
|
- **Shared by [optional]:** [More Information Needed]
|
||||||
|
- **Model type:** [More Information Needed]
|
||||||
|
- **Language(s) (NLP):** [More Information Needed]
|
||||||
|
- **License:** [More Information Needed]
|
||||||
|
- **Finetuned from model [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
### Model Sources [optional]
|
||||||
|
|
||||||
|
<!-- Provide the basic links for the model. -->
|
||||||
|
|
||||||
|
- **Repository:** [More Information Needed]
|
||||||
|
- **Paper [optional]:** [More Information Needed]
|
||||||
|
- **Demo [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
## Uses
|
||||||
|
|
||||||
|
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
||||||
|
|
||||||
|
### Direct Use
|
||||||
|
|
||||||
|
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Downstream Use [optional]
|
||||||
|
|
||||||
|
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Out-of-Scope Use
|
||||||
|
|
||||||
|
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Bias, Risks, and Limitations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Recommendations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
||||||
|
|
||||||
|
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
||||||
|
|
||||||
|
## How to Get Started with the Model
|
||||||
|
|
||||||
|
Use the code below to get started with the model.
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Training Details
|
||||||
|
|
||||||
|
### Training Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Training Procedure
|
||||||
|
|
||||||
|
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
||||||
|
|
||||||
|
#### Preprocessing [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
|
||||||
|
#### Training Hyperparameters
|
||||||
|
|
||||||
|
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
||||||
|
|
||||||
|
#### Speeds, Sizes, Times [optional]
|
||||||
|
|
||||||
|
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Evaluation
|
||||||
|
|
||||||
|
<!-- This section describes the evaluation protocols and provides the results. -->
|
||||||
|
|
||||||
|
### Testing Data, Factors & Metrics
|
||||||
|
|
||||||
|
#### Testing Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card if possible. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Factors
|
||||||
|
|
||||||
|
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Results
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Examination [optional]
|
||||||
|
|
||||||
|
<!-- Relevant interpretability work for the model goes here -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Environmental Impact
|
||||||
|
|
||||||
|
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
||||||
|
|
||||||
|
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
||||||
|
|
||||||
|
- **Hardware Type:** [More Information Needed]
|
||||||
|
- **Hours used:** [More Information Needed]
|
||||||
|
- **Cloud Provider:** [More Information Needed]
|
||||||
|
- **Compute Region:** [More Information Needed]
|
||||||
|
- **Carbon Emitted:** [More Information Needed]
|
||||||
|
|
||||||
|
## Technical Specifications [optional]
|
||||||
|
|
||||||
|
### Model Architecture and Objective
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Compute Infrastructure
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Hardware
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Software
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Citation [optional]
|
||||||
|
|
||||||
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||||
|
|
||||||
|
**BibTeX:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
**APA:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Glossary [optional]
|
||||||
|
|
||||||
|
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## More Information [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Authors [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Contact
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
### Framework versions
|
||||||
|
|
||||||
|
- PEFT 0.19.1
|
||||||
52
qwen3-0.6b/adapters/adapter_config.json
Normal file
52
qwen3-0.6b/adapters/adapter_config.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"alora_invocation_tokens": null,
|
||||||
|
"alpha_pattern": {},
|
||||||
|
"arrow_config": null,
|
||||||
|
"auto_mapping": {
|
||||||
|
"base_model_class": "Qwen3ForCausalLM",
|
||||||
|
"parent_library": "transformers.models.qwen3.modeling_qwen3",
|
||||||
|
"unsloth_fixed": true
|
||||||
|
},
|
||||||
|
"base_model_name_or_path": "unsloth/qwen3-0.6b-unsloth-bnb-4bit",
|
||||||
|
"bias": "none",
|
||||||
|
"corda_config": null,
|
||||||
|
"ensure_weight_tying": false,
|
||||||
|
"eva_config": null,
|
||||||
|
"exclude_modules": null,
|
||||||
|
"fan_in_fan_out": false,
|
||||||
|
"inference_mode": true,
|
||||||
|
"init_lora_weights": true,
|
||||||
|
"layer_replication": null,
|
||||||
|
"layers_pattern": null,
|
||||||
|
"layers_to_transform": null,
|
||||||
|
"loftq_config": {},
|
||||||
|
"lora_alpha": 64,
|
||||||
|
"lora_bias": false,
|
||||||
|
"lora_dropout": 0.0,
|
||||||
|
"lora_ga_config": null,
|
||||||
|
"megatron_config": null,
|
||||||
|
"megatron_core": "megatron.core",
|
||||||
|
"modules_to_save": null,
|
||||||
|
"peft_type": "LORA",
|
||||||
|
"peft_version": "0.19.1",
|
||||||
|
"qalora_group_size": 16,
|
||||||
|
"r": 32,
|
||||||
|
"rank_pattern": {},
|
||||||
|
"revision": null,
|
||||||
|
"target_modules": [
|
||||||
|
"down_proj",
|
||||||
|
"o_proj",
|
||||||
|
"gate_proj",
|
||||||
|
"q_proj",
|
||||||
|
"up_proj",
|
||||||
|
"k_proj",
|
||||||
|
"v_proj"
|
||||||
|
],
|
||||||
|
"target_parameters": null,
|
||||||
|
"task_type": "CAUSAL_LM",
|
||||||
|
"trainable_token_indices": null,
|
||||||
|
"use_bdlora": null,
|
||||||
|
"use_dora": false,
|
||||||
|
"use_qalora": false,
|
||||||
|
"use_rslora": false
|
||||||
|
}
|
||||||
3
qwen3-0.6b/adapters/adapter_model.safetensors
Normal file
3
qwen3-0.6b/adapters/adapter_model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2f6aa46ce50ec9c526a0975f8ba80ad831031edf618be46972dd81425e8e61e3
|
||||||
|
size 80792456
|
||||||
99
qwen3-0.6b/adapters/chat_template.jinja
Normal file
99
qwen3-0.6b/adapters/chat_template.jinja
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
{%- if tools %}
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- messages[0].content + '\n\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||||
|
{%- for forward_message in messages %}
|
||||||
|
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||||
|
{%- set message = messages[index] %}
|
||||||
|
{%- set current_content = message.content if message.content is defined and message.content is not none else '' %}
|
||||||
|
{%- set tool_start = '<tool_response>' %}
|
||||||
|
{%- set tool_start_length = tool_start|length %}
|
||||||
|
{%- set start_of_message = current_content[:tool_start_length] %}
|
||||||
|
{%- set tool_end = '</tool_response>' %}
|
||||||
|
{%- set tool_end_length = tool_end|length %}
|
||||||
|
{%- set start_pos = (current_content|length) - tool_end_length %}
|
||||||
|
{%- if start_pos < 0 %}
|
||||||
|
{%- set start_pos = 0 %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set end_of_message = current_content[start_pos:] %}
|
||||||
|
{%- if ns.multi_step_tool and message.role == "user" and not(start_of_message == tool_start and end_of_message == tool_end) %}
|
||||||
|
{%- set ns.multi_step_tool = false %}
|
||||||
|
{%- set ns.last_query_index = index %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{%- set m_content = message.content if message.content is defined and message.content is not none else '' %}
|
||||||
|
{%- set content = m_content %}
|
||||||
|
{%- set reasoning_content = '' %}
|
||||||
|
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
||||||
|
{%- set reasoning_content = message.reasoning_content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- if '</think>' in m_content %}
|
||||||
|
{%- set content = (m_content.split('</think>')|last).lstrip('\n') %}
|
||||||
|
{%- set reasoning_content = (m_content.split('</think>')|first).rstrip('\n') %}
|
||||||
|
{%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\n') %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if loop.index0 > ns.last_query_index %}
|
||||||
|
{%- if loop.last or (not loop.last and (not reasoning_content.strip() == '')) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if message.tool_calls %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if (loop.first and content) or (not loop.first) %}
|
||||||
|
{{- '\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<tool_call>\n{"name": "' }}
|
||||||
|
{{- tool_call.name }}
|
||||||
|
{{- '", "arguments": ' }}
|
||||||
|
{%- if tool_call.arguments is string %}
|
||||||
|
{{- tool_call.arguments }}
|
||||||
|
{%- else %}
|
||||||
|
{{- tool_call.arguments | tojson }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '}\n</tool_call>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{{- message.content }}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||||
|
{{- '<think>\n\n</think>\n\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
3
qwen3-0.6b/adapters/tokenizer.json
Normal file
3
qwen3-0.6b/adapters/tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
|
||||||
|
size 11423114
|
||||||
233
qwen3-0.6b/adapters/tokenizer_config.json
Normal file
233
qwen3-0.6b/adapters/tokenizer_config.json
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": null,
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"is_local": false,
|
||||||
|
"model_max_length": 40960,
|
||||||
|
"pad_token": "<|PAD_TOKEN|>",
|
||||||
|
"padding_side": "left",
|
||||||
|
"split_special_tokens": false,
|
||||||
|
"tokenizer_class": "Qwen2Tokenizer",
|
||||||
|
"unk_token": null,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"151643": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151644": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151645": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151646": {
|
||||||
|
"content": "<|object_ref_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151647": {
|
||||||
|
"content": "<|object_ref_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151648": {
|
||||||
|
"content": "<|box_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151649": {
|
||||||
|
"content": "<|box_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151650": {
|
||||||
|
"content": "<|quad_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151651": {
|
||||||
|
"content": "<|quad_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151652": {
|
||||||
|
"content": "<|vision_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151653": {
|
||||||
|
"content": "<|vision_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151654": {
|
||||||
|
"content": "<|vision_pad|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151655": {
|
||||||
|
"content": "<|image_pad|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151656": {
|
||||||
|
"content": "<|video_pad|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151657": {
|
||||||
|
"content": "<tool_call>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151658": {
|
||||||
|
"content": "</tool_call>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151659": {
|
||||||
|
"content": "<|fim_prefix|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151660": {
|
||||||
|
"content": "<|fim_middle|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151661": {
|
||||||
|
"content": "<|fim_suffix|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151662": {
|
||||||
|
"content": "<|fim_pad|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151663": {
|
||||||
|
"content": "<|repo_name|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151664": {
|
||||||
|
"content": "<|file_sep|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151665": {
|
||||||
|
"content": "<tool_response>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151666": {
|
||||||
|
"content": "</tool_response>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151667": {
|
||||||
|
"content": "<think>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151668": {
|
||||||
|
"content": "</think>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151669": {
|
||||||
|
"content": "<|PAD_TOKEN|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-F16.gguf
Normal file
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:141d507c4393251443afe63236d594f6b8c45f22cb546ff4076461ef53d9a9c1
|
||||||
|
size 1198182944
|
||||||
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf
Normal file
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4d15b8fb273552fc9b1c6bc347185767e2f3dc0437a1cb14575080a2c5407bc8
|
||||||
|
size 396705312
|
||||||
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q5_K_M.gguf
Normal file
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4b09c532c64fd3b75eab6abc628329e1530242b350f54ef206c174c0fdbf2d68
|
||||||
|
size 444415520
|
||||||
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q6_K.gguf
Normal file
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q6_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:57a7472c85fe51c5205783e1d81aea69fff4fa4df5ae3edbf9b5e58bf0392937
|
||||||
|
size 495107616
|
||||||
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q8_0.gguf
Normal file
3
qwen3-0.6b/gguf/txn-parser-qwen3-0.6b-Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2b64fb71f6c9775fb2e73c3514109e640787bca28b2f67aec1e76c37ed71dffc
|
||||||
|
size 639447584
|
||||||
152
smollm2-360m/README.md
Normal file
152
smollm2-360m/README.md
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
|
||||||
|
tags:
|
||||||
|
- text-generation
|
||||||
|
- lora
|
||||||
|
- qlora
|
||||||
|
- gguf
|
||||||
|
- transaction-parser
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
- hi
|
||||||
|
library_name: peft
|
||||||
|
---
|
||||||
|
|
||||||
|
# txn-parser / smollm2-360m
|
||||||
|
|
||||||
|
QLoRA fine-tune of [`HuggingFaceTB/SmolLM2-360M-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct) for
|
||||||
|
extracting structured transaction data (amount, currency, item, category,
|
||||||
|
type) from free-form Indian-English / code-switched speech and text.
|
||||||
|
|
||||||
|
This model lives in subfolder **`smollm2-360m/`** of the
|
||||||
|
[`kartikey31/txn-parser`](https://huggingface.co/kartikey31/txn-parser) repo, alongside
|
||||||
|
sibling fine-tunes of other base models trained on the same data.
|
||||||
|
|
||||||
|
## What's in here
|
||||||
|
|
||||||
|
- `smollm2-360m/adapters/` — PEFT LoRA adapter (rank 32). Load on top of the base model
|
||||||
|
with `peft.PeftModel.from_pretrained(base, "kartikey31/txn-parser", subfolder="smollm2-360m/adapters")`.
|
||||||
|
- `smollm2-360m/gguf/` — merged GGUF builds at multiple quantization levels
|
||||||
|
(file names follow `txn-parser-smollm2-360m-<QUANT>.gguf`):
|
||||||
|
- [`smollm2-360m/gguf/txn-parser-smollm2-360m-F16.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/smollm2-360m/gguf/txn-parser-smollm2-360m-F16.gguf) (725.6 MB)
|
||||||
|
- [`smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf) (270.6 MB)
|
||||||
|
- [`smollm2-360m/gguf/txn-parser-smollm2-360m-Q5_K_M.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/smollm2-360m/gguf/txn-parser-smollm2-360m-Q5_K_M.gguf) (289.9 MB)
|
||||||
|
- [`smollm2-360m/gguf/txn-parser-smollm2-360m-Q6_K.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/smollm2-360m/gguf/txn-parser-smollm2-360m-Q6_K.gguf) (367.4 MB)
|
||||||
|
- [`smollm2-360m/gguf/txn-parser-smollm2-360m-Q8_0.gguf`](https://huggingface.co/kartikey31/txn-parser/resolve/main/smollm2-360m/gguf/txn-parser-smollm2-360m-Q8_0.gguf) (386.4 MB)
|
||||||
|
|
||||||
|
## Training data
|
||||||
|
|
||||||
|
- 93,348 teacher-labeled examples (`data/distill/train.jsonl`)
|
||||||
|
- 300 held-out eval examples (`data/distill/eval.jsonl`)
|
||||||
|
- Validator-gated: every row's `output` passes the project's grammar +
|
||||||
|
amount-parser semantic validator.
|
||||||
|
|
||||||
|
## Training config
|
||||||
|
|
||||||
|
| Knob | Value |
|
||||||
|
|---|---|
|
||||||
|
| Base model | `HuggingFaceTB/SmolLM2-360M-Instruct` |
|
||||||
|
| Method | QLoRA (4-bit) via Unsloth |
|
||||||
|
| LoRA rank | 32 (alpha 64, dropout 0.0) |
|
||||||
|
| Epochs | 2 |
|
||||||
|
| Batch size (train) | 64 |
|
||||||
|
| Grad accumulation | 1 |
|
||||||
|
| Eval batch size | 16 |
|
||||||
|
| Max seq length | 1024 |
|
||||||
|
| Learning rate | 2e-4 (warmup 3%) |
|
||||||
|
| Started | 2026-05-22T21:26:43.776899+00:00 |
|
||||||
|
| Finished | 2026-05-22T21:30:14.660709+00:00 |
|
||||||
|
|
||||||
|
## System prompt (use this EXACTLY)
|
||||||
|
|
||||||
|
The model was trained with one specific system prompt and Gemma/Smol/Qwen
|
||||||
|
chat template. If you paraphrase the prompt or skip the chat template,
|
||||||
|
quality degrades quickly. Copy-paste this verbatim into your inference
|
||||||
|
client (no leading/trailing whitespace, no edits):
|
||||||
|
|
||||||
|
```text
|
||||||
|
You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.
|
||||||
|
```
|
||||||
|
|
||||||
|
Source of truth: [`scripts/_lib.py`](https://github.com/kartikeychoudhary/txn-parser/blob/main/scripts/_lib.py)
|
||||||
|
constant `SYSTEM_PROMPT`. Don't retype it — pull from `_lib.py` or this README.
|
||||||
|
|
||||||
|
## Download a single GGUF
|
||||||
|
|
||||||
|
```bash
|
||||||
|
huggingface-cli download kartikey31/txn-parser \
|
||||||
|
smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf \
|
||||||
|
--local-dir .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (Python, llama-cpp-python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
SYSTEM_PROMPT = '''You convert voice-transcribed transaction descriptions into structured JSON.
|
||||||
|
|
||||||
|
Output ONLY a JSON object with this schema, no other text:
|
||||||
|
{"transactions":[{"amount":<number>,"currency":"INR"|"USD","item":"<lowercase singular noun phrase>","category":"<enum>","type":"expense"|"income"}]}
|
||||||
|
|
||||||
|
Categories: Food, Drinks, Groceries, Transport, Shopping, Entertainment, Bills, Health, Education, Personal, Gifts, Income, Other.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Currency defaults to INR. Use USD only when the input explicitly says "dollars" or contains "$".
|
||||||
|
- Amounts: "k" = ×1000, "hazaar" = ×1000, "sau" = ×100, "lakh" = ×100000. Convert number-words ("five hundred") to digits.
|
||||||
|
- type is "expense" by default; "income" only for explicit salary, cashback, refund, gift received, payment received.
|
||||||
|
- For disfluencies and corrections ("500 wait no 600"), output the CORRECTED amount only.
|
||||||
|
- For ambiguous items ("that thing", "stuff"), use item "unspecified" and category "Other".
|
||||||
|
- Item field: lowercase singular noun phrase ("uber ride", "beer", "chai" — not "Beers" or "Uber").
|
||||||
|
- Multi-transaction inputs become multiple array entries in spoken order.
|
||||||
|
- Category heuristics: uber/ola/auto/petrol/bus/metro → Transport; beer/wine/chai/coffee/juice → Drinks; rent/electricity/wifi/recharge/gas → Bills; movie/netflix/concert → Entertainment; doctor/medicine/hospital → Health.'''
|
||||||
|
|
||||||
|
llm = Llama(
|
||||||
|
model_path="txn-parser-smollm2-360m-Q4_K_M.gguf",
|
||||||
|
n_gpu_layers=-1, n_ctx=2048,
|
||||||
|
)
|
||||||
|
out = llm.create_chat_completion(
|
||||||
|
messages=[
|
||||||
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
|
{"role": "user", "content": "200 ka samosa"},
|
||||||
|
],
|
||||||
|
temperature=0.0,
|
||||||
|
)
|
||||||
|
print(out["choices"][0]["message"]["content"])
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inference (CLI, llama.cpp)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./llama-cli -m txn-parser-smollm2-360m-Q4_K_M.gguf \
|
||||||
|
--grammar-file scripts/grammar.gbnf \
|
||||||
|
--system-prompt "$(cat system_prompt.txt)" \
|
||||||
|
-p "200 ka samosa" -n 256
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reproduce
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/kartikeychoudhary/txn-parser.git
|
||||||
|
cd txn-parser && bash setup.sh
|
||||||
|
python scripts/train_and_publish.py --only smollm2-360m
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
*Auto-published by `scripts/train_and_publish.py` on 2026-05-22T21:30:14.964463+00:00.*
|
||||||
210
smollm2-360m/adapters/README.md
Normal file
210
smollm2-360m/adapters/README.md
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
---
|
||||||
|
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
|
||||||
|
library_name: peft
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
tags:
|
||||||
|
- base_model:adapter:HuggingFaceTB/SmolLM2-360M-Instruct
|
||||||
|
- lora
|
||||||
|
- sft
|
||||||
|
- transformers
|
||||||
|
- trl
|
||||||
|
- unsloth
|
||||||
|
---
|
||||||
|
|
||||||
|
# Model Card for Model ID
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
### Model Description
|
||||||
|
|
||||||
|
<!-- Provide a longer summary of what this model is. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- **Developed by:** [More Information Needed]
|
||||||
|
- **Funded by [optional]:** [More Information Needed]
|
||||||
|
- **Shared by [optional]:** [More Information Needed]
|
||||||
|
- **Model type:** [More Information Needed]
|
||||||
|
- **Language(s) (NLP):** [More Information Needed]
|
||||||
|
- **License:** [More Information Needed]
|
||||||
|
- **Finetuned from model [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
### Model Sources [optional]
|
||||||
|
|
||||||
|
<!-- Provide the basic links for the model. -->
|
||||||
|
|
||||||
|
- **Repository:** [More Information Needed]
|
||||||
|
- **Paper [optional]:** [More Information Needed]
|
||||||
|
- **Demo [optional]:** [More Information Needed]
|
||||||
|
|
||||||
|
## Uses
|
||||||
|
|
||||||
|
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
||||||
|
|
||||||
|
### Direct Use
|
||||||
|
|
||||||
|
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Downstream Use [optional]
|
||||||
|
|
||||||
|
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Out-of-Scope Use
|
||||||
|
|
||||||
|
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Bias, Risks, and Limitations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Recommendations
|
||||||
|
|
||||||
|
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
||||||
|
|
||||||
|
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
||||||
|
|
||||||
|
## How to Get Started with the Model
|
||||||
|
|
||||||
|
Use the code below to get started with the model.
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Training Details
|
||||||
|
|
||||||
|
### Training Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Training Procedure
|
||||||
|
|
||||||
|
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
||||||
|
|
||||||
|
#### Preprocessing [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
|
||||||
|
#### Training Hyperparameters
|
||||||
|
|
||||||
|
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
||||||
|
|
||||||
|
#### Speeds, Sizes, Times [optional]
|
||||||
|
|
||||||
|
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Evaluation
|
||||||
|
|
||||||
|
<!-- This section describes the evaluation protocols and provides the results. -->
|
||||||
|
|
||||||
|
### Testing Data, Factors & Metrics
|
||||||
|
|
||||||
|
#### Testing Data
|
||||||
|
|
||||||
|
<!-- This should link to a Dataset Card if possible. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Factors
|
||||||
|
|
||||||
|
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Results
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Summary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Examination [optional]
|
||||||
|
|
||||||
|
<!-- Relevant interpretability work for the model goes here -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Environmental Impact
|
||||||
|
|
||||||
|
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
||||||
|
|
||||||
|
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
||||||
|
|
||||||
|
- **Hardware Type:** [More Information Needed]
|
||||||
|
- **Hours used:** [More Information Needed]
|
||||||
|
- **Cloud Provider:** [More Information Needed]
|
||||||
|
- **Compute Region:** [More Information Needed]
|
||||||
|
- **Carbon Emitted:** [More Information Needed]
|
||||||
|
|
||||||
|
## Technical Specifications [optional]
|
||||||
|
|
||||||
|
### Model Architecture and Objective
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
### Compute Infrastructure
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Hardware
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
#### Software
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Citation [optional]
|
||||||
|
|
||||||
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||||
|
|
||||||
|
**BibTeX:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
**APA:**
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Glossary [optional]
|
||||||
|
|
||||||
|
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## More Information [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Authors [optional]
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
|
||||||
|
## Model Card Contact
|
||||||
|
|
||||||
|
[More Information Needed]
|
||||||
|
### Framework versions
|
||||||
|
|
||||||
|
- PEFT 0.19.1
|
||||||
52
smollm2-360m/adapters/adapter_config.json
Normal file
52
smollm2-360m/adapters/adapter_config.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"alora_invocation_tokens": null,
|
||||||
|
"alpha_pattern": {},
|
||||||
|
"arrow_config": null,
|
||||||
|
"auto_mapping": {
|
||||||
|
"base_model_class": "LlamaForCausalLM",
|
||||||
|
"parent_library": "transformers.models.llama.modeling_llama",
|
||||||
|
"unsloth_fixed": true
|
||||||
|
},
|
||||||
|
"base_model_name_or_path": "HuggingFaceTB/SmolLM2-360M-Instruct",
|
||||||
|
"bias": "none",
|
||||||
|
"corda_config": null,
|
||||||
|
"ensure_weight_tying": false,
|
||||||
|
"eva_config": null,
|
||||||
|
"exclude_modules": null,
|
||||||
|
"fan_in_fan_out": false,
|
||||||
|
"inference_mode": true,
|
||||||
|
"init_lora_weights": true,
|
||||||
|
"layer_replication": null,
|
||||||
|
"layers_pattern": null,
|
||||||
|
"layers_to_transform": null,
|
||||||
|
"loftq_config": {},
|
||||||
|
"lora_alpha": 64,
|
||||||
|
"lora_bias": false,
|
||||||
|
"lora_dropout": 0.0,
|
||||||
|
"lora_ga_config": null,
|
||||||
|
"megatron_config": null,
|
||||||
|
"megatron_core": "megatron.core",
|
||||||
|
"modules_to_save": null,
|
||||||
|
"peft_type": "LORA",
|
||||||
|
"peft_version": "0.19.1",
|
||||||
|
"qalora_group_size": 16,
|
||||||
|
"r": 32,
|
||||||
|
"rank_pattern": {},
|
||||||
|
"revision": null,
|
||||||
|
"target_modules": [
|
||||||
|
"down_proj",
|
||||||
|
"v_proj",
|
||||||
|
"up_proj",
|
||||||
|
"k_proj",
|
||||||
|
"gate_proj",
|
||||||
|
"o_proj",
|
||||||
|
"q_proj"
|
||||||
|
],
|
||||||
|
"target_parameters": null,
|
||||||
|
"task_type": "CAUSAL_LM",
|
||||||
|
"trainable_token_indices": null,
|
||||||
|
"use_bdlora": null,
|
||||||
|
"use_dora": false,
|
||||||
|
"use_qalora": false,
|
||||||
|
"use_rslora": false
|
||||||
|
}
|
||||||
3
smollm2-360m/adapters/adapter_model.safetensors
Normal file
3
smollm2-360m/adapters/adapter_model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9b4d482a8fd5bb463dd858f9d8b576759471cf800f45e12660cfc22090988dae
|
||||||
|
size 69527352
|
||||||
6
smollm2-360m/adapters/chat_template.jinja
Normal file
6
smollm2-360m/adapters/chat_template.jinja
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
|
||||||
|
You are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>
|
||||||
|
' }}{% endif %}{{'<|im_start|>' + message['role'] + '
|
||||||
|
' + message['content'] + '<|im_end|>' + '
|
||||||
|
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
||||||
|
' }}{% endif %}
|
||||||
244965
smollm2-360m/adapters/tokenizer.json
Normal file
244965
smollm2-360m/adapters/tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
154
smollm2-360m/adapters/tokenizer_config.json
Normal file
154
smollm2-360m/adapters/tokenizer_config.json
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": "<|im_start|>",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"extra_special_tokens": [],
|
||||||
|
"is_local": false,
|
||||||
|
"model_max_length": 8192,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"padding_side": "left",
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"unk_token": "<|endoftext|>",
|
||||||
|
"vocab_size": 49152,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"0": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"content": "<repo_name>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"4": {
|
||||||
|
"content": "<reponame>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"content": "<file_sep>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"content": "<filename>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"7": {
|
||||||
|
"content": "<gh_stars>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"8": {
|
||||||
|
"content": "<issue_start>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"9": {
|
||||||
|
"content": "<issue_comment>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"10": {
|
||||||
|
"content": "<issue_closed>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"11": {
|
||||||
|
"content": "<jupyter_start>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"content": "<jupyter_text>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"13": {
|
||||||
|
"content": "<jupyter_code>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"14": {
|
||||||
|
"content": "<jupyter_output>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"15": {
|
||||||
|
"content": "<jupyter_script>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"16": {
|
||||||
|
"content": "<empty_output>",
|
||||||
|
"single_word": false,
|
||||||
|
"lstrip": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
smollm2-360m/gguf/txn-parser-smollm2-360m-F16.gguf
Normal file
3
smollm2-360m/gguf/txn-parser-smollm2-360m-F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:92b07b803de61d1fd4ec1297001bef5e60d0e6859d92e6faedbfa2d5acb4dbce
|
||||||
|
size 725553792
|
||||||
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf
Normal file
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6a4edeff22ebbb1eabc5ab89624f2ecd5202af034cea61fe0ccd422e4e586505
|
||||||
|
size 270590592
|
||||||
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q5_K_M.gguf
Normal file
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:dc8df0629cc58887b569c77d9f12aea04f70dbfeaf57431b2eedd5c220ba9ba1
|
||||||
|
size 289944192
|
||||||
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q6_K.gguf
Normal file
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q6_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:193c4b51e556101707420668b1df4770e32f13e7553fd1f6a12c877de3e99dec
|
||||||
|
size 367358592
|
||||||
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q8_0.gguf
Normal file
3
smollm2-360m/gguf/txn-parser-smollm2-360m-Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8a1714b9ae16ada16ea318342661ffbf9d73295d9f42b7c6e33bf10e3dd7af03
|
||||||
|
size 386404992
|
||||||
Reference in New Issue
Block a user