Instructions to use pankajmathur/orca_mini_phi-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pankajmathur/orca_mini_phi-4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pankajmathur/orca_mini_phi-4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pankajmathur/orca_mini_phi-4") model = AutoModelForCausalLM.from_pretrained("pankajmathur/orca_mini_phi-4") 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 pankajmathur/orca_mini_phi-4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pankajmathur/orca_mini_phi-4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pankajmathur/orca_mini_phi-4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pankajmathur/orca_mini_phi-4
- SGLang
How to use pankajmathur/orca_mini_phi-4 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 "pankajmathur/orca_mini_phi-4" \ --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": "pankajmathur/orca_mini_phi-4", "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 "pankajmathur/orca_mini_phi-4" \ --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": "pankajmathur/orca_mini_phi-4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pankajmathur/orca_mini_phi-4 with Docker Model Runner:
docker model run hf.co/pankajmathur/orca_mini_phi-4
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("pankajmathur/orca_mini_phi-4")
model = AutoModelForCausalLM.from_pretrained("pankajmathur/orca_mini_phi-4")
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]:]))Model Name: orca_mini_phi-4
orca_mini_phi-4 is trained with various SFT Datasets on microsoft/phi-4 using Llama's architecture.
"Obsessed with Open Source GenAI's potential? So am I ! Let's Contribute together 🚀 https://www.linkedin.com/in/pankajam"
NOTICE
By providing proper credit and attribution, you are granted permission to use this model as a foundational base for further Full fine tuning, DPO, PPO or ORPO tuning and any kind of Merges. I actively encourage users to customize and enhance the model according to their specific needs, as this version is designed to be a comprehensive general model. Dive in and innovate!
Example Usage
Use this model for Free on Google Colab with T4 GPU :)
Example Usage on Your Personal Computer
Download GGUF version here and Follow Ollama instructions: https://huggingface.co/pankajmathur/orca_mini_phi-4-GGUF
Below shows a code example on how to use this model in default half precision (bfloat16) format
import torch
from transformers import pipeline
model_slug = "pankajmathur/orca_mini_phi-4"
pipeline = pipeline(
"text-generation",
model=model_slug,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are Orca Mini, a helpful AI assistant."},
{"role": "user", "content": "Hello Orca Mini, what can you do for me?"}
]
outputs = pipeline(messages, max_new_tokens=128, do_sample=True, temperature=0.01, top_k=100, top_p=0.95)
print(outputs[0]["generated_text"][-1])
Below shows a code example on how to use this model in 4-bit format via bitsandbytes library
import torch
from transformers import BitsAndBytesConfig, pipeline
model_slug = "pankajmathur/orca_mini_phi-4"
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype="float16",
bnb_4bit_use_double_quant=True,
)
pipeline = pipeline(
"text-generation",
model=model_slug,
model_kwargs={"quantization_config": quantization_config},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are Orca Mini, a helpful AI assistant."},
{"role": "user", "content": "Hello Orca Mini, what can you do for me?"}
]
outputs = pipeline(messages, max_new_tokens=128, do_sample=True, temperature=0.01, top_k=100, top_p=0.95)
print(outputs[0]["generated_text"][-1])
Below shows a code example on how to use this model in 8-bit format via bitsandbytes library
import torch
from transformers import BitsAndBytesConfig, pipeline
model_slug = "pankajmathur/orca_mini_phi-4"
quantization_config = BitsAndBytesConfig(
load_in_8bit=True
)
pipeline = pipeline(
"text-generation",
model=model_slug,
model_kwargs={"quantization_config": quantization_config},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are Orca Mini, a helpful AI assistant."},
{"role": "user", "content": "Hello Orca Mini, what can you do for me?"}
]
outputs = pipeline(messages, max_new_tokens=128, do_sample=True, temperature=0.01, top_k=100, top_p=0.95)
print(outputs[0]["generated_text"][-1])
- Downloads last month
- 866
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pankajmathur/orca_mini_phi-4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)