File size: 924 Bytes
93a77c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
param(
    [Parameter(Position = 0)] [string] $RepoId,
    [switch] $Private,
    [switch] $DryRun,
    [string] $Revision
)

$ErrorActionPreference = "Stop"
$UploadArguments = @((Join-Path $PSScriptRoot "scripts/upload_dataset.py"))
if ($RepoId) { $UploadArguments += $RepoId }
if ($Private) { $UploadArguments += "--private" }
if ($DryRun) { $UploadArguments += "--dry-run" }
if ($Revision) { $UploadArguments += @("--revision", $Revision) }

if (Get-Command py -ErrorAction SilentlyContinue) {
    & py -3 @UploadArguments
} elseif (Get-Command python -ErrorAction SilentlyContinue) {
    & python @UploadArguments
} else {
    Write-Host "Python 3 is missing. Install Python 3, then rerun this script."
    exit 1
}
$UploadExit = $LASTEXITCODE
if ($UploadExit -ne 0) {
    Write-Host "Missing dependency: python -m pip install --upgrade huggingface_hub"
    Write-Host "Authentication: hf auth login"
}
exit $UploadExit