Text Generation
Transformers
Safetensors
English
qwen2
finance
banking
indian
upi
transaction-classification
qwen
fine-tuned
conversational
text-generation-inference
Run this model with HF Jobs
Run SahilGoel/indian-txn-classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/SahilGoel/indian-txn-classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/SahilGoel/indian-txn-classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/SahilGoel/indian-txn-classifier. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/SahilGoel/indian-txn-classifier. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use SahilGoel/indian-txn-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SahilGoel/indian-txn-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SahilGoel/indian-txn-classifier") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SahilGoel/indian-txn-classifier") model = AutoModelForCausalLM.from_pretrained("SahilGoel/indian-txn-classifier", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SahilGoel/indian-txn-classifier with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SahilGoel/indian-txn-classifier" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SahilGoel/indian-txn-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SahilGoel/indian-txn-classifier
- SGLang
How to use SahilGoel/indian-txn-classifier with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SahilGoel/indian-txn-classifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SahilGoel/indian-txn-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SahilGoel/indian-txn-classifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SahilGoel/indian-txn-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SahilGoel/indian-txn-classifier with Docker Model Runner:
docker model run hf.co/SahilGoel/indian-txn-classifier
Upload code/pii_shield.py with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293"""pii_shield.py — Lightweight PII Masking=======================================Masks sensitive data before logging or sending to external services.Pure regex, zero dependencies — works in 512MB environments.
Detects & masks: - PAN numbers (ABCDE1234F pattern) - Aadhaar numbers (12 digits) - Bank account numbers (9-18 digits near keywords) - IFSC codes - Mobile numbers - Email addresses"""
import reimport logging
logger = logging.getLogger(__name__)
PII_PATTERNS = [ { "name": "PAN", "pattern": r'\b([A-Z]{5}\d{4}[A-Z])\b', "mask": "XXXXX0000X", }, { "name": "Aadhaar", "pattern": r'\b(\d{4}[\s\-]?\d{4}[\s\-]?\d{4})\b', "mask": "XXXX-XXXX-XXXX", }, { "name": "Mobile", "pattern": r'(?:\+91[\s\-]?)?\b([6-9]\d{9})\b', "mask": "XXXXXXXXXX", }, { "name": "Email", "pattern": r'\b([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\b', "mask": "***@***.***", }, { "name": "IFSC", "pattern": r'\b([A-Z]{4}0[A-Z0-9]{6})\b', "mask": "XXXX0XXXXXX", }, { "name": "BankAccount", "pattern": r'(?:account[\s\-:]*(?:no|number|num)?[\s\-:]*)\b(\d{9,18})\b', "mask": "XXXXXXXXXX", "case_insensitive": True, },]
def mask_pii(text: str) -> str: """Mask all PII patterns in the given text. Returns sanitized text.""" masked = text for p in PII_PATTERNS: flags = re.IGNORECASE if p.get("case_insensitive") else 0 pattern = p["pattern"] mask = p["mask"] count = 0 def replace(m): nonlocal count count += 1 return mask masked = re.sub(pattern, replace, masked, flags=flags) if count > 0: logger.debug(f"PII Shield: masked {count} {p['name']}(s)") return masked
def has_pii(text: str) -> bool: """Check if text contains any PII. Returns True if sensitive data detected.""" for p in PII_PATTERNS: flags = re.IGNORECASE if p.get("case_insensitive") else 0 if re.search(p["pattern"], text, flags): return True return False
def shield_transaction(description: str) -> str: """Shield a single transaction description — masks PAN/Aadhaar but preserves merchant info.""" # Only mask PAN and Aadhaar — keep bank account numbers visible for classification for pattern_name in ["PAN", "Aadhaar"]: for p in PII_PATTERNS: if p["name"] == pattern_name: description = re.sub(p["pattern"], p["mask"], description) return descriptioncode/pii_shield.pyAdded+93