File size: 1,271 Bytes
bf9f498 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | [CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory = $true)]
[ValidatePattern('^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$')]
[string] $RepoId,
[string] $HfCommand = 'hf',
[switch] $CreatePullRequest
)
$ErrorActionPreference = 'Stop'
$releaseRoot = $PSScriptRoot
$validator = Join-Path $releaseRoot 'scripts\validate_release.py'
python $validator
if ($LASTEXITCODE -ne 0) {
throw 'Release validation failed; upload stopped.'
}
& $HfCommand auth whoami --format json | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Hugging Face login required. Run: $HfCommand auth login"
}
if (-not $PSCmdlet.ShouldProcess($RepoId, 'Create public model repository and upload UMoX documentation')) {
return
}
& $HfCommand repos create $RepoId --type model --public --exist-ok
if ($LASTEXITCODE -ne 0) {
throw 'Hugging Face repository creation failed.'
}
$uploadArgs = @(
'upload',
$RepoId,
$releaseRoot,
'.',
'--type', 'model',
'--commit-message', 'Publish UMoX Qwen3.6 Snapdragon X2 research prototype'
)
if ($CreatePullRequest) {
$uploadArgs += '--create-pr'
}
& $HfCommand @uploadArgs
if ($LASTEXITCODE -ne 0) {
throw 'Hugging Face upload failed.'
}
Write-Host "Published https://huggingface.co/$RepoId"
|