Instructions to use Mubin1917/Fhi-3.5-mini-instruct-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mubin1917/Fhi-3.5-mini-instruct-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mubin1917/Fhi-3.5-mini-instruct-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mubin1917/Fhi-3.5-mini-instruct-2") model = AutoModelForCausalLM.from_pretrained("Mubin1917/Fhi-3.5-mini-instruct-2") 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 Settings
- vLLM
How to use Mubin1917/Fhi-3.5-mini-instruct-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mubin1917/Fhi-3.5-mini-instruct-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mubin1917/Fhi-3.5-mini-instruct-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mubin1917/Fhi-3.5-mini-instruct-2
- SGLang
How to use Mubin1917/Fhi-3.5-mini-instruct-2 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 "Mubin1917/Fhi-3.5-mini-instruct-2" \ --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": "Mubin1917/Fhi-3.5-mini-instruct-2", "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 "Mubin1917/Fhi-3.5-mini-instruct-2" \ --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": "Mubin1917/Fhi-3.5-mini-instruct-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Mubin1917/Fhi-3.5-mini-instruct-2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mubin1917/Fhi-3.5-mini-instruct-2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mubin1917/Fhi-3.5-mini-instruct-2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mubin1917/Fhi-3.5-mini-instruct-2 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Mubin1917/Fhi-3.5-mini-instruct-2", max_seq_length=2048, ) - Docker Model Runner
How to use Mubin1917/Fhi-3.5-mini-instruct-2 with Docker Model Runner:
docker model run hf.co/Mubin1917/Fhi-3.5-mini-instruct-2
This page is work in progress!
Overview
The Fhi-3.5-mini-instruct is a fine-tuned version of the unsloth/Phi-3.5-mini-instruct model, optimized for function-calling.
Usage
Here’s a basic example of how to use function calling with the Fhi-3.5-mini-instruct model:
def get_current_temperature(location: str) -> float:
"""
Get the current temperature at a location.
Args:
location: The location to get the temperature for, in the format "City, Country"
Returns:
The current temperature at the specified location in the specified units, as a float.
"""
return 22.
# Create the messages list
messages = [
{"role": "system", "content": "You are a helpful weather assistant."},
{"role": "user", "content": "What's the current weather in London and New York? Please use Celsius."}
]
# Apply the chat template
prompt = tokenizer.apply_chat_template(
messages,
tools=[get_current_temperature], # Pass the custom tool
add_generation_prompt=True,
tokenize=False
)
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False, num_return_sequences=1, use_cache=True, temperature=0.001, top_p=1, eos_token_id=[32007])
resu = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
print(resu)
The result will look like this:
[
{'name': 'get_current_temperature', 'arguments': {'location': 'London, UK'}},
{'name': 'get_current_temperature', 'arguments': {'location': 'New York, USA'}}
]
Testing and Benchmarking
This model is still undergoing testing and evaluation. Use it at your own risk until further validation is complete. Performance on benchmarks like MMLU and MMLU-Pro will be updated soon.
| Benchmark | Fhi-3.5 Mini-Ins | Phi-3.5 Mini-Ins | Mistral-7B-Instruct-v0.3 | Mistral-Nemo-12B-Ins-2407 | Llama-3.1-8B-Ins | Gemma-2-9B-Ins | Gemini 1.5 Flash | GPT-4o-mini-2024-07-18 (Chat) |
|---|---|---|---|---|---|---|---|---|
| Multilingual MMLU | ____ | 55.4 | 47.4 | 58.9 | 56.2 | 63.8 | 77.2 | 72.9 |
| MMLU (5-shot) | __ | 69 | 60.3 | 67.2 | 68.1 | 71.3 | 78.7 | 77.2 |
| MMLU-Pro (3-shot, CoT) | __ | 47.4 | 18 | 40.7 | 44 | 50.1 | 57.2 | 62.8 |
Credits
Will be updated soon
- Downloads last month
- 6
Model tree for Mubin1917/Fhi-3.5-mini-instruct-2
Base model
microsoft/Phi-3.5-mini-instruct