Text Generation
Transformers
English
phi3
finance
entity-extraction
ner
phi-3
production
indian-banking
custom_code
4-bit precision
Instructions to use Ranjit0034/finance-entity-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ranjit0034/finance-entity-extractor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ranjit0034/finance-entity-extractor", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ranjit0034/finance-entity-extractor", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Ranjit0034/finance-entity-extractor", trust_remote_code=True) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Ranjit0034/finance-entity-extractor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ranjit0034/finance-entity-extractor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ranjit0034/finance-entity-extractor", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ranjit0034/finance-entity-extractor
- SGLang
How to use Ranjit0034/finance-entity-extractor 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 "Ranjit0034/finance-entity-extractor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ranjit0034/finance-entity-extractor", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Ranjit0034/finance-entity-extractor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ranjit0034/finance-entity-extractor", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ranjit0034/finance-entity-extractor with Docker Model Runner:
docker model run hf.co/Ranjit0034/finance-entity-extractor
| """ | |
| Tests for FinEE Merchants and Rules (Tier 2). | |
| """ | |
| from finee.merchants import ( | |
| extract_merchant_from_vpa, | |
| get_category_from_merchant, | |
| get_merchant_and_category, | |
| get_category_from_text, | |
| ) | |
| from finee.schema import Category | |
| def test_vpa_to_merchant(): | |
| """Test extracting merchant names from VPAs.""" | |
| cases = [ | |
| ("swiggy@ybl", "Swiggy"), | |
| ("zomato@paytm", "Zomato"), | |
| ("uber@okaxis", "Uber"), | |
| ("AMAZONPAY@ICICI", "Amazon"), | |
| ("zerodhabroking@kbl", "Zerodha"), | |
| ("unknown@ybl", None), | |
| ] | |
| for vpa, expected in cases: | |
| assert extract_merchant_from_vpa(vpa) == expected | |
| def test_merchant_to_category(): | |
| """Test mapping merchants to categories.""" | |
| cases = [ | |
| ("Swiggy", "food"), | |
| ("Uber", "transport"), | |
| ("Netflix", "entertainment"), | |
| ("Zerodha", "investment"), | |
| ("Apollo Pharmacy", "healthcare"), | |
| ("Unknown Shop", None), | |
| ] | |
| for merchant, expected in cases: | |
| assert get_category_from_merchant(merchant) == expected | |
| def test_text_category_inference(): | |
| """Test inferring category from text keywords.""" | |
| cases = [ | |
| ("Lunch at restaurant", "food"), | |
| ("Taxi ride to airport", "transport"), | |
| ("Monthly movie subscription", "entertainment"), | |
| ("Electricity bill payment", "utilities"), | |
| ("Unknown transaction", None), | |
| ] | |
| for text, expected in cases: | |
| assert get_category_from_text(text) == expected | |
| def test_combined_lookup(): | |
| """Test the combined lookup function.""" | |
| merchant, category = get_merchant_and_category(vpa="swiggy@ybl") | |
| assert merchant == "Swiggy" | |
| assert category == "food" | |
| # Fallback to text for category | |
| merchant, category = get_merchant_and_category(vpa="unknown@ybl", text="payment for petrol") | |
| assert merchant is None | |
| assert category == "transport" | |