Skip to content

Commit b6b4750

Browse files
sebastienrosradical
authored andcommitted
Improve AI Foundry Local models detection (#12461)
* Improve AI Foundry Local models detection * Ignore unverified npu models
1 parent fb30697 commit b6b4750

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Aspire.Hosting.Azure.AIFoundry/AIFoundryModel.Local.Generated.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public static class Local
1818
public static readonly AIFoundryModel DeepseekR114b = new() { Name = "deepseek-r1-14b", Version = "3", Format = "Microsoft" };
1919

2020
/// <summary>
21-
/// This model is an optimized version of DeepSeek-R1-Distill-Qwen-7B to enable local inference. This model uses RTN quantization. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** MIT - **Model Description:** This is a conversion of the DeepSeek-R1-Distill-Qwen-7B for local inference. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) for details.
21+
/// This model is an optimized version of DeepSeek-R1-Distill-Qwen-7B to enable local inference on Intel NPUs. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** MIT - **Model Description:** This is a conversion of the DeepSeek-R1-Distill-Qwen-7B for local inference on Intel NPUs. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) for details.
2222
/// </summary>
23-
public static readonly AIFoundryModel DeepseekR17b = new() { Name = "deepseek-r1-7b", Version = "3", Format = "Microsoft" };
23+
public static readonly AIFoundryModel DeepseekR17b = new() { Name = "deepseek-r1-7b", Version = "1", Format = "Microsoft" };
2424

2525
/// <summary>
2626
/// This model is an optimized version of gpt-oss-20b to enable local inference. This model uses RTN quantization. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** Apache-2.0 - **License Description:** Use of this model is subject to the terms of the Apache License, Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. - **Model Description:** This is a conversion of the gpt-oss-20b model for local inference. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Azure AI Foundry model [gpt-oss-20b](https://ai.azure.com/catalog/models/gpt-oss-20b) for details.
2727
/// </summary>
2828
public static readonly AIFoundryModel GptOss20b = new() { Name = "gpt-oss-20b", Version = "1", Format = "Microsoft" };
2929

3030
/// <summary>
31-
/// This model is an optimized version of Mistral-7B-Instruct-v0.2 to enable local inference. This model uses RTN quantization. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** apache-2.0 - **Model Description:** This is a conversion of the Mistral-7B-Instruct-v0.2 for local inference. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) for details.
31+
/// This model is an optimized version of Mistral-7B-Instruct-v0.2 to enable local inference on Intel NPUs. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** apache-2.0 - **Model Description:** This is a conversion of the Mistral-7B-Instruct-v0.2 for local inference on Intel NPUs. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) for details.
3232
/// </summary>
3333
public static readonly AIFoundryModel Mistral7bV02 = new() { Name = "mistral-7b-v0.2", Version = "1", Format = "Microsoft" };
3434

@@ -72,6 +72,11 @@ public static class Local
7272
/// </summary>
7373
public static readonly AIFoundryModel Qwen2515b = new() { Name = "qwen2.5-1.5b", Version = "3", Format = "Microsoft" };
7474

75+
/// <summary>
76+
/// This model is an optimized version of Qwen2.5-1.5B-Instruct to enable local inference on AMD NPUs. This model uses post-training quantization. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** apache-2.0 - **Model Description:** This is a conversion of the Qwen2.5-1.5B-Instruct for local inference on AMD NPUs. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) for details.
77+
/// </summary>
78+
public static readonly AIFoundryModel Qwen2515bInstructTestVitisNpu = new() { Name = "qwen2.5-1.5b-instruct-test-vitis-npu", Version = "1", Format = "Microsoft" };
79+
7580
/// <summary>
7681
/// This model is an optimized version of Qwen2.5-14B-Instruct to enable local inference. This model uses RTN quantization. # Model Description - **Developed by:** Microsoft - **Model type:** ONNX - **License:** apache-2.0 - **Model Description:** This is a conversion of the Qwen2.5-14B-Instruct for local inference. - **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied. Note that optimizations applied are distinct from fine tuning and thus do not alter the intended uses or capabilities of the model. # Base Model Information See Hugging Face model [Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) for details.
7782
/// </summary>

src/Aspire.Hosting.Azure.AIFoundry/tools/GenModel.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ public async Task<string> GetModelsAsync(string? continuationToken = null)
460460
{"field": "type", "operator": "eq", "values": ["models"]},
461461
{"field": "kind", "operator": "eq", "values": ["Versioned"]},
462462
{"field": "labels", "operator": "eq", "values": ["latest"]},
463-
{"field": "annotations/archived", "operator": "ne", "values": ["false"]},
464-
{"field": "annotations/tags/foundryLocal", "operator": "eq", "values": [""]},
463+
{"field": "annotations/tags/foundryLocal", "operator": "eq", "values": ["", "test"]},
465464
{"field": "properties/variantInfo/variantMetadata/device", "operator": "eq",
466465
"values": ["cpu", "gpu", "npu"]}
467466
],
@@ -510,9 +509,13 @@ private void RunFixups(List<ModelEntity> allModels)
510509
{
511510
if (_isFoundryLocal)
512511
{
513-
// Exclude phi-4-reasoning as it is not listed by foundry local (TBD)
512+
// Exclude models that are not listed by foundry local (TBD)
514513
// c.f. https://github.com/microsoft/Foundry-Local/issues/245#issuecomment-3404022929
515-
allModels.RemoveAll(m => m.Annotations?.Tags?.TryGetValue("alias", out var alias) is not null && alias == "phi-4-reasoning");
514+
allModels.RemoveAll(m => m.Annotations?.Tags?.TryGetValue("alias", out var alias) is true && alias is not null &&
515+
(alias.Contains("whisper") ||
516+
alias == "phi-4-reasoning" ||
517+
alias == "qwen2.5-1.5b-instruct-test-qnn-npu" ||
518+
alias == "qwen2.5-1.5b-instruct-test-openvino-npu"));
516519
}
517520
else
518521
{

0 commit comments

Comments
 (0)