Downloads · 30 days
28
10% of all-time downloads
gagan1985/qwen3-0.6b-indian-address-parser
qwen3-0.6b-indian-address-parser is a text generation model from gagan1985. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter fine-tuned on Qwen/Qwen3-0.6B that parses raw, unstructured Indian address strings into 13 structured fields, output as JSON.
Downloads · 30 days
28
10% of all-time downloads
All-time downloads
275
Public
Repo size
57.6 MB
Likes
1
Public
Click a slice to open those files.
.safetensors46.2 MB · 74%
From the Hugging Face model README
A LoRA adapter fine-tuned on Qwen/Qwen3-0.6B that parses raw, unstructured Indian address strings into 13 structured fields, output as JSON.
Input: "FLAT NO.32, UTTARA TOWERS, MG ROAD GUWAHATI , Kamrup Unclassified AS 781029"
Output: {"houseNumber": "FLAT NO.32", "houseName": "UTTARA TOWERS", "poi": null,
"street": "MG ROAD", "subsubLocality": null, "subLocality": null, "locality": null,
"village": null, "subDistrict": null, "district": "Kamrup", "city": "GUWAHATI",
"state": "AS", "pincode": "781029"}
pip install indian-address-parser
Source, CLI, and a benchmark comparison against shiprocket-ai/open-tinybert-indian-address-ner are on GitHub: innerkorehq/indian-address-parser.
Training was done with MLX (mlx-lm's lora
command) on Apple Silicon. The repo root has a PEFT-format conversion of that adapter
so it loads on any platform (CUDA, MPS, CPU) via standard transformers+peft — the
mlx/ subfolder has the original MLX artifacts for Apple Silicon users. Both were
verified to produce matching output (13/15 identical on a held-out spot check; the 2
differences landed on fields already noted as ambiguous below — consistent with
floating-point differences between backends on a near-tied decision, not a conversion error).
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "gagan1985/qwen3-0.6b-indian-address-parser"
tokenizer = AutoTokenizer.from_pretrained(repo)
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B", torch_dtype=torch.bfloat16)
model = PeftModel.from_pretrained(base, repo)
SYSTEM_PROMPT = (
"You are an Indian address parser. Given a raw address string, extract address "
"fields and return them as a JSON object. Use null for fields not present in the "
"address. Output only the JSON object, no explanation.\n\n"
"Fields: houseNumber, houseName, poi, street, subsubLocality, subLocality, "
"locality, village, subDistrict, district, city, state, pincode"
)
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Parse this address:\n<your address here>"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False, pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Or use the included inference.py / evaluate.py (download the repo, then
python inference.py --model Qwen/Qwen3-0.6B --adapter . "<address>").
mlx_lm.load's adapter_path only accepts a local directory, not an HF repo ID — so
fetch the mlx/ subfolder first, then point at it locally:
from huggingface_hub import snapshot_download
import mlx_lm
local_dir = snapshot_download("gagan1985/qwen3-0.6b-indian-address-parser", allow_patterns=["mlx/*"])
model, tokenizer = mlx_lm.load("Qwen/Qwen3-0.6B", adapter_path=f"{local_dir}/mlx")
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Parse this address:\n<your address here>"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
print(mlx_lm.generate(model, tokenizer, prompt=prompt, max_tokens=512, verbose=False))
Or use mlx/inference_mlx.py / mlx/evaluate_mlx.py from a local checkout.
houseNumber, houseName, poi, street, subsubLocality, subLocality,
locality, village, subDistrict, district, city, state, pincode
deepseek/deepseek-v4-pro via OpenRouter, span-verified against the raw address text
— any field value not found verbatim in the source string was dropped, not guessed)| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen3-0.6B (28 layers) |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Fine-tuned layers | 16 (of 28) |
| Iterations | 2000 (≈3.75 epochs at batch=8) |
| Learning rate | 2e-4 |
| Trainable params | 5.77M / 596M (0.968%) |
| Field | Accuracy | Recall | Gold presence |
|---|---|---|---|
| pincode | 100.0% | 100.0% | 100.0% |
| state | 94.9% | 96.2% | 98.7% |
| district | 94.9% | 95.1% | 68.8% |
| houseNumber | 90.3% | 84.5% | 54.4% |
| city | 90.3% | 91.3% | 62.9% |
| houseName | 87.3% | 88.5% | 43.9% |
| subDistrict | 86.1% | 29.6% | 11.4% |
| poi | 84.0% | 30.8% | 16.5% |
| village | 75.1% | 43.8% | 27.0% |
| subLocality | 74.3% | 21.6% | 21.5% |
| subsubLocality | 72.6% | 31.2% | 27.0% |
| street | 64.6% | 55.6% | 53.2% |
| locality | 56.5% | 35.6% | 43.9% |
locality/subLocality/subsubLocality/village overlap conceptually. These
represent the same "named area, different granularity" concept, and disagreements are
often the model extracting the correct substring into an adjacent bucket rather than
a genuine extraction miss — the gold labels themselves are sometimes inconsistent here
(the same place name occasionally appears in two of these fields simultaneously in gold).street sometimes over-absorbs multi-part location clusters (e.g. "KARBI PATH, ZOO
NARENGI ROAD, BAMUNIMAIDAN" tagged entirely as street instead of being split across
street/subsubLocality/subLocality), likely because that split pattern is
underrepresented in training data (subsubLocality/subLocality gold presence is only
~21-27%)."PEDANANDIPALLE AGRAHARAMPEDANANDIPALLE AGRAHARAM")
that the model sometimes reproduces with minor copy errors.Root (PEFT format):
adapter_model.safetensors + adapter_config.json — standard PEFT LoRA adaptertokenizer.json, tokenizer_config.json, vocab.json, merges.txt,
special_tokens_map.json, added_tokens.json, chat_template.jinja — tokenizer filesinference.py / evaluate.py — CLI scripts (single address, stdin/file batch, or
full test-set evaluation) using transformers+peftconfig.py — shared constants (SYSTEM_PROMPT, field list, prompt template)mlx/ (original MLX format, Apple Silicon):
adapters.safetensors + adapter_config.json — mlx-lm's native adapter format
(adapter_config.json here is mlx-lm's training-run metadata, not a PEFT LoraConfig)inference_mlx.py / evaluate_mlx.py — same CLI shape as the root scripts, via mlx-lmconfig.py — same constants, duplicated here so this subfolder is usable standalone