Files
vector-search-csharp/VectorSearchApp/Models/Models/download-custom-model.ps1

36 lines
1.4 KiB
PowerShell

#!/usr/bin/env pwsh
# Download script for custom address embedding model (ONNX format)
# This script downloads a pre-converted ONNX model if available
$ModelRepo = "jarredparrett/all-MiniLM-L6-v2_tuned_on_deepparse_address_mutations_comb_3"
$OutputPath = "Models/address-embedding-model.onnx"
Write-Host "Attempting to download pre-converted ONNX model..." -ForegroundColor Cyan
# Try to download from HuggingFace Hub (ONNX format if available)
$OnnxUrl = "https://huggingface.co/$ModelRepo/resolve/main/onnx/model.onnx"
try {
$ProgressPreference = 'SilentlyContinue'
if (Get-Command curl -ErrorAction SilentlyContinue) {
curl -L -o $OutputPath $OnnxUrl --fail
} else {
Invoke-WebRequest -Uri $OnnxUrl -OutFile $OutputPath -UseBasicParsing
}
if (Test-Path $OutputPath) {
$size = (Get-Item $OutputPath).Length / 1MB
Write-Host "Successfully downloaded model to $OutputPath" -ForegroundColor Green
Write-Host "File size: $([math]::Round($size, 2)) MB" -ForegroundColor Gray
}
}
catch {
Write-Host "Could not download pre-converted ONNX model." -ForegroundColor Yellow
Write-Host ""
Write-Host "The model does not have a pre-converted ONNX format." -ForegroundColor White
Write-Host "Please run the Python conversion script instead:" -ForegroundColor White
Write-Host " python download-convert-model.py" -ForegroundColor Gray
exit 1
}