Instructions to use ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True) 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned
- SGLang
How to use ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned 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 "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned" \ --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": "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", "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 "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned" \ --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": "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned with Docker Model Runner:
docker model run hf.co/ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages)# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned", trust_remote_code=True)
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))🧑⚖️ vakil-phi3-mini-4k-instruct-finetuned
📌 Overview
This repository hosts a fine‑tuned version of microsoft/Phi‑3‑mini‑4k‑instruct (3.8B parameters), adapted specifically for Indian legal knowledge tasks.
The model was instruction‑tuned using LoRA (Low‑Rank Adaptation) on curated datasets covering constitutional acts and statutory sections.
The objective of this fine‑tuning was to enhance the model’s ability to deliver accurate, contextual, and explainable outputs for legal queries in the Indian domain.
⚙️ Training Details
- Base Model: microsoft/Phi‑3‑mini‑4k‑instruct
- Fine‑Tuning Method: LoRA (parameter‑efficient fine‑tuning)
- Domain Data: Indian constitutional acts, statutory sections, and related legal texts
- Training Infrastructure: RunPod RTX A6000 GPU
- Training Duration: 18 hours, 2 epochs
- Optimization Goal: Reduce training loss and improve domain‑specific accuracy
📊 Evaluation
Intrinsic Evaluation:
- Reduced perplexity compared to the base model
- Improved accuracy on domain‑specific test sets
Extrinsic Evaluation:
- Better parsing of statutes and structured legal outputs
- Enhanced contextual reasoning in legal Q&A tasks
Qualitative Observations:
- More consistent responses when asked about constitutional provisions
- Improved ability to generate structured JSON outputs for legal sections
🚀 Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
inputs = tokenizer("Explain Article 21 of the Indian Constitution:", return_tensors="pt")
outputs = model.generate(**inputs, max_length=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 26
Model tree for ManjunathCode10x/vakil-phi3-mini-4k-instruct-finetuned
Base model
microsoft/Phi-3-mini-4k-instruct
# Gated model: Login with a HF token with gated access permission hf auth login