Run this model with HF Jobs

Run microsoft/phi-4 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/microsoft/phi-4. 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/microsoft/phi-4 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/microsoft/phi-4. 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/microsoft/phi-4. 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.

Phi-4 with Tools

#28
by tahafatih - opened

Is it possible to use the Phi-4 model with Tools?

I've been using Phi-4 with json style and python tool calling (in smolagents) agents. I was loading it with llama.cpp, so I had to write my own "model" to support it, but phi-4 is my favorite 'smaller' tool calling model I've used so far.

@RecViking please elaborate on how you were able to use Phi-4 w/ tool-calling

@mayonesa - I created a new "model" within the system so I could manually manipulate the grammars passed to the model. With some of the recent updates, the openai compatibility has improved and allows for additional parameters. You should be able to self host using something like llama.cpp and set up grammars for tool calling using the openai "model" (wrapper for openai library).

@RecViking please elaborate on how you were able to use Phi-4 w/ tool-calling

with smolagents, phi-4 also works using a TGI server. just set up an endpoint with TGI, use the OpenAIServerModel from smolagents and you are pretty much good to go

@mayonesa could you potentially link your implementation in a gist? I'm trying to get it working in vLLM/Pydantic AI but I'm having a hell of a time trying to write a tool call parser for it

Sign up or log in to comment