-
Notifications
You must be signed in to change notification settings - Fork 337
fetches test models from azure storage blob #848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
prathikr
wants to merge
27
commits into
main
Choose a base branch
from
prathikrao/fetch-test-data-from-blob
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e7c16ae
impl
327fbe3
diff azure sub
2a8f8d2
tests
ce025b0
Foundry Local PME
4f56d23
add azure sub
68e757c
final azure sub
d20474b
Merge remote-tracking branch 'origin' into prathikrao/fetch-test-data…
7dae763
filepaths
a150003
hella logs
608ef78
bug
35d10d3
pls
b460966
simplify
2704f9a
bug fix
c2d6362
map
d9f5de2
Merge branch 'prathikrao/fetch-test-data-from-blob' of https://github…
4a260e9
versioned model names
f90d010
/Microsoft
cf1802e
revert
5175a47
reset
76bbecb
local
69ad060
correct test env var
5a72185
test suite
c38240d
c# fix
76f6983
logs
827cd45
cmon
d4ed493
inference_model.json
70d4f1c
reset
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| # Download test model data from blob storage into a local directory. | ||
| # Uses azcopy with AZCLI auth so the agent identity can read from storage. | ||
|
|
||
| parameters: | ||
| - name: destinationPath | ||
| type: string | ||
| default: '$(Build.SourcesDirectory)/test-data-shared' | ||
|
|
||
| steps: | ||
| - task: AzureCLI@2 | ||
| displayName: 'Fetch test data from blob' | ||
| inputs: | ||
| azureSubscription: 'ortcibuild_readonly_mi2-ONNX Runtime-AIFoundryLocal' | ||
| scriptType: pscore | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| $destination = '${{ parameters.destinationPath }}' | ||
| $storageAccount = 'foundrylocalmodels' | ||
| $container = 'models' | ||
| $prefix = 'foundrylocal/models' | ||
|
|
||
| if (-not (Get-Command azcopy -ErrorAction SilentlyContinue)) { | ||
| if ($IsMacOS) { | ||
| Write-Host 'azcopy not found on macOS agent. Installing via Homebrew...' | ||
| if (-not (Get-Command brew -ErrorAction SilentlyContinue)) { | ||
| throw 'Homebrew is required to install azcopy on macOS agents, but brew was not found.' | ||
| } | ||
|
|
||
| brew update --quiet | ||
| brew install --quiet azcopy | ||
| } else { | ||
| throw 'azcopy is not installed on this agent.' | ||
| } | ||
| } | ||
|
|
||
| azcopy --version | ||
|
|
||
| New-Item -ItemType Directory -Path $destination -Force | Out-Null | ||
| $publisherRoot = Join-Path $destination 'Microsoft' | ||
| New-Item -ItemType Directory -Path $publisherRoot -Force | Out-Null | ||
|
|
||
| function Invoke-AzCopy { | ||
| param( | ||
| [string]$Source, | ||
| [string]$Target | ||
| ) | ||
|
|
||
| $parent = Split-Path -Path $Target -Parent | ||
| if (-not [string]::IsNullOrEmpty($parent)) { | ||
| New-Item -ItemType Directory -Path $parent -Force | Out-Null | ||
| } | ||
|
|
||
| $args = @('copy', $Source, $Target, '--recursive') | ||
|
|
||
| & azcopy @args | ||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "azcopy failed downloading test data from $Source" | ||
| } | ||
| } | ||
|
|
||
| function Generate-InferenceModelJson { | ||
| param( | ||
| [string]$ModelRoot, | ||
| [string]$TargetAlias | ||
| ) | ||
|
|
||
| if ($TargetAlias -notmatch '-\d+$') { | ||
| throw "TargetAlias '$TargetAlias' does not end with a numeric version suffix." | ||
| } | ||
|
|
||
| # Convert '<name>-<version>' to '<name>:<version>' by replacing the last '-'. | ||
| $modelId = $TargetAlias -replace '-(?=[^-]+$)', ':' | ||
|
|
||
| $inferenceModelPath = Join-Path $ModelRoot 'inference_model.json' | ||
| @{ Name = $modelId } | | ||
| ConvertTo-Json -Depth 2 | | ||
| Set-Content -Path $inferenceModelPath -Encoding utf8 | ||
|
|
||
| Write-Host "Generated inference_model.json: $inferenceModelPath (Name=$modelId)" | ||
| } | ||
|
|
||
| # The active SDK tests resolve versioned model aliases in cache. | ||
| # Keep explicit version per model, then derive target alias and v{N} path. | ||
| $modelMappings = @( | ||
| @{ | ||
| SourcePath = 'qwen2.5-0.5b-instruct' | ||
| Version = 4 | ||
| }, | ||
| @{ | ||
| SourcePath = 'openai-whisper-tiny' | ||
| Version = 4 | ||
| }, | ||
| @{ | ||
| SourcePath = 'nemotron-speech-streaming-en-0.6b' | ||
| Version = 3 | ||
| }, | ||
| @{ | ||
| SourcePath = 'qwen3-embedding-0.6b' | ||
| Version = 1 | ||
| }, | ||
| @{ | ||
| SourcePath = 'qwen3.5-0.8b' | ||
| Version = 2 | ||
| }, | ||
| @{ | ||
| SourcePath = 'deepseek-r1-distill-qwen-14b' | ||
| Version = 4 | ||
| } | ||
| ) | ||
|
|
||
| foreach ($model in $modelMappings) { | ||
| $targetAlias = "$($model.SourcePath)-generic-cpu-$($model.Version)" | ||
| $requestedUrl = "https://$storageAccount.blob.core.windows.net/$container/$prefix/$($model.SourcePath)/onnx/cpu_and_mobile/v$($model.Version)/*" | ||
| Write-Host "Requested blob URL: $requestedUrl" | ||
|
|
||
| $target = Join-Path (Join-Path $publisherRoot $targetAlias) ("v" + $model.Version) | ||
| Invoke-AzCopy -Source $requestedUrl -Target $target | ||
| Generate-InferenceModelJson -ModelRoot $target -TargetAlias $targetAlias | ||
| } | ||
|
|
||
| $count = @(Get-ChildItem -Path $destination -Recurse -File).Count | ||
|
|
||
| if ($count -eq 0) { | ||
| throw "Downloaded test data is empty at $destination" | ||
| } | ||
|
|
||
| Write-Host "Downloaded $count files into $destination" | ||
| Write-Host "Cache directory contents for $destination" | ||
| (Get-ChildItem -Path $destination -Recurse -Force | | ||
| Select-Object FullName, Length | | ||
| Format-Table -AutoSize | | ||
| Out-String).TrimEnd() | Write-Host | ||
| env: | ||
| AZCOPY_AUTO_LOGIN_TYPE: AZCLI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should developers download these models for testing?
Should we instead just download the model from FL SDK for local runs and use the cache for CI runs?
Or perhaps can we share instructions that developers should do to run these tests locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And instructions for how to update the test models available.