Skip to content

Add Foundry Local deployment skill - #243

Merged
justinchuby merged 7 commits into
mainfrom
skill-foundry-local
May 5, 2026
Merged

Add Foundry Local deployment skill#243
justinchuby merged 7 commits into
mainfrom
skill-foundry-local

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

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

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 <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 4597a2a3c69cf6

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 agent skill documenting how to take a mobius ORT GenAI export and register/run it in Microsoft Foundry Local. This fits the repo’s skills library by covering downstream deployment of exported ONNX packages.

Changes:

  • Adds a new .agents skill for Foundry Local deployment and troubleshooting.
  • Documents cache-based custom model registration and inference_model.json.
  • Includes CLI/API usage, limitations, and an end-to-end example workflow.

Comment thread .agents/skills/foundry-local/SKILL.md Outdated
Comment thread .agents/skills/foundry-local/SKILL.md Outdated
Comment thread .agents/skills/foundry-local/SKILL.md
Comment thread .agents/skills/foundry-local/SKILL.md Outdated
@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!

@titaiwangms titaiwangms 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.

Nice skill doc! A few suggestions from our Pixtral/Ministral-3 VLM work:

1. Missing processor_config.json in copy step
Pixtral/Ministral-3 VLM exports use processor_config.json (not image_processor.json) for the vision preprocessing pipeline. Without copying this file, VLM inference will fail — the PixtralImageSizes and other preprocessing transforms won't be loaded. Suggest adding:

cp output/processor_config.json "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null

2. Missing single-component model copy
Text-only LLMs export as model.onnx + model.onnx.data at the output root (not in a decoder/ subdirectory). The copy commands only handle multi-component subdirs. Suggest adding:

cp output/model.onnx* "${CACHE_DIR}/models/Custom/${MODEL_NAME}/" 2>/dev/null

3. model_type path is nested
The workaround says to set model_type: "decoder" but the actual key path in genai_config.json is model.type (nested under the model object), not a top-level key.

4. Mistral3 prompt template (nice-to-have)
The skill includes ChatML, Llama, and Gemma templates but not Mistral3's [INST]/[/INST] format. Since Ministral-3 is now supported via mobius, this would be a helpful addition.

Address all 4 review findings:

1. Fix prerequisites to describe both single-model (root-level
   model.onnx) and multi-model (decoder/, embedding/, etc.) layouts.

2. Fix copy commands to handle single-model exports (cp model.onnx*
   and *.safetensors from root) plus a simpler cp -r output/*
   alternative.

3. Add processor_config.json to the copy list alongside
   image_processor.json — needed for Pixtral/Mistral3 vision exports.

4. Fix model_type workaround: correct JSON path is model.type
   (not top-level model_type). Added JSON snippet showing the
   correct structure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
@justinchuby

Copy link
Copy Markdown
Member Author

@titaiwangms Done

justinchuby and others added 5 commits May 4, 2026 23:29
… Local skill

Add prominent WARNING in prerequisites about foundry-local-sdk
overriding custom ORT/GenAI builds, with the force-reinstall
workaround (symlink replacement works because Foundry's native
core links to Python-installed .so files).

Add 'Building ORT and GenAI from source' section linking to
issue #245 for the full build tutorial.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
…ocal

New skill at .agents/skills/building-ort-genai/SKILL.md covering:
- CUDA toolkit (12.8+/13.0) and cuDNN 9.x setup
- ORT build from source with all CUDA flags (flash attention,
  architecture selection, cuDNN paths)
- ORT install layout creation for GenAI linking
- GenAI build from source linked to custom ORT
- Build verification commands
- 6 common issues: cuDNN mismatch, LD_LIBRARY_PATH, pip overrides,
  ABI mismatch, test target failures, flash attention

Updated foundry-local skill to cross-reference the new skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Add specific download URLs for CUDA 12.8 and cuDNN 9.8, concrete
install paths ($HOME/cuda12.8, $HOME/cudnn9.8), and the pip-based
cuDNN alternative. Restructured to 7 clear steps with explicit
commands throughout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Update all CUDA references from 12.8 to 13.0: download URL,
install path ($HOME/cuda13.0), PATH and LD_LIBRARY_PATH examples,
and build flags. cuDNN 9.8 (cuda12 archive) remains — it's
compatible with both CUDA 12.x and 13.x.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Change nvidia-cudnn-cu12 pip package to nvidia-cudnn-cu13 and
update cuDNN archive filename to cuda13 variant to match CUDA 13.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>
@justinchuby
justinchuby merged commit 0d8a635 into main May 5, 2026
22 checks passed
@justinchuby
justinchuby deleted the skill-foundry-local branch May 5, 2026 01:48
@justinchuby

justinchuby commented May 5, 2026

Copy link
Copy Markdown
Member Author

Will improve build instruction if needed

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.

3 participants