Skip to content

Add Foundry Local deployment skill - #242

Closed
justinchuby wants to merge 1 commit into
mainfrom
gemma4-static-cache
Closed

justinchuby wants to merge 1 commit into
mainfrom
gemma4-static-cache

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Document how to deploy mobius-exported ONNX models to Microsoft Foundry Local.

What this adds

New skill at .agents/skills/foundry-local/SKILL.md covering:

  • Custom model registration — cache directory structure, file copying, verification
  • inference_model.json format — field reference + common prompt templates (ChatML, Llama, Gemma)
  • Running models — CLI (foundry model run), OpenAI-compatible API, Python SDK
  • Known limitations — bundled GenAI version, no CUDA in pip SDK, multimodal requirements, model_type workaround
  • End-to-end example — complete workflow from mobius build to local inference

Reference: https://techcommunity.microsoft.com/blog/educatordeveloperblog/deploying-custom-models-with-microsoft-olive-and-foundry-local/4489002

Document the workflow for deploying mobius-exported ONNX models to
Microsoft Foundry Local:

- Custom model registration via the cache directory
- inference_model.json format with common prompt templates (ChatML,
  Llama, Gemma)
- CLI (foundry model run) and OpenAI-compatible API access
- Python SDK usage and discovery limitations
- Known limitations: bundled GenAI version, no CUDA in pip SDK,
  multimodal requires GenAI 0.14+, model_type whitelist workaround
- Complete end-to-end example from export to local inference

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby requested review from a team and Copilot May 4, 2026 20:48
@justinchuby

Copy link
Copy Markdown
Member Author

Closing — wrong branch name (gemma4-static-cache). Reopened as a new PR from the correct skill-foundry-local branch.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing d39b13b → bfe5da6

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 107 107 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 53 53 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 61 61 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 58 58 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 98 98 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 59 59 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 61 61 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 58 58 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 275 275 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 129 129 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 408 408 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new documentation “skill” describing how to deploy mobius-exported ORT GenAI model directories into Microsoft Foundry Local for local inference, including cache registration, inference_model.json prompt templating, and basic CLI/API usage.

Changes:

  • Added a new .agents/skills/foundry-local/SKILL.md skill document for Foundry Local deployment.
  • Documented cache-based custom model registration and inference_model.json prompt template examples.
  • Included runtime notes/limitations and an end-to-end export → register → run walkthrough.

Comment on lines +39 to +40
The output directory must contain `genai_config.json`, tokenizer
files, and the model sub-directories (decoder/, embedding/, etc.).
Comment on lines +70 to +75
# Copy all model files
cp -r output/decoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
cp -r output/embedding/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp -r output/vision_encoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp -r output/audio_encoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp output/genai_config.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
Comment on lines +67 to +78
Copy the entire mobius export output into the model directory:

```bash
# Copy all model files
cp -r output/decoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
cp -r output/embedding/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp -r output/vision_encoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp -r output/audio_encoder/ "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp output/genai_config.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
cp output/tokenizer* "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
cp output/image_processor.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp output/audio_processor.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
Comment on lines +76 to +78
cp output/tokenizer* "${CACHE_DIR}/models/Custom/${MODEL_NAME}/"
cp output/image_processor.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
cp output/audio_processor.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null
Comment on lines +86 to +88
cat > "${CACHE_DIR}/models/Custom/${MODEL_NAME}/inference_model.json" << 'EOF'
{
"Name": "my-custom-model",
Comment on lines +274 to +275
unregistered model_type, set `model_type: "decoder"` in
`genai_config.json` as a workaround.
@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

justinchuby added a commit that referenced this pull request May 5, 2026
Document how to deploy mobius-exported ONNX models to Microsoft Foundry
Local.

## What this adds

New skill at `.agents/skills/foundry-local/SKILL.md` covering:

- **Custom model registration** — cache directory structure, file
copying, verification
- **inference_model.json format** — field reference + common prompt
templates (ChatML, Llama, Gemma)
- **Running models** — CLI (`foundry model run`), OpenAI-compatible API,
Python SDK
- **Known limitations** — bundled GenAI version, no CUDA in pip SDK,
multimodal requirements, model_type workaround
- **End-to-end example** — complete workflow from `mobius build` to
local inference

Reference:
https://techcommunity.microsoft.com/blog/educatordeveloperblog/deploying-custom-models-with-microsoft-olive-and-foundry-local/4489002

Replaces #242 (closed due to wrong branch name).

---------

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants