File size: 1,640 Bytes
82782ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
param(
    [Parameter(Mandatory = $true)]
    [string]$RepoId,

    [string]$Token = ""
)

$ErrorActionPreference = "Stop"

Write-Host "This uploads the GGUF LoRA adapter repo to Hugging Face:" -ForegroundColor Cyan
Write-Host $RepoId -ForegroundColor Yellow
Write-Host ""
Write-Host "Important: this is an adapter repo, not a standalone merged full model." -ForegroundColor Yellow
Write-Host ""

if (-not (Get-Command hf -ErrorAction SilentlyContinue)) {
    $hfFromPython = Join-Path $env:LOCALAPPDATA "Python\pythoncore-3.14-64\Scripts\hf.exe"
    if (Test-Path -LiteralPath $hfFromPython) {
        $script:HfCli = $hfFromPython
    }
    else {
        $script:HfCli = "hf"
    }
}
else {
    $script:HfCli = "hf"
}

if (-not (Get-Command $script:HfCli -ErrorAction SilentlyContinue) -and -not (Test-Path -LiteralPath $script:HfCli)) {
    Write-Host "Installing huggingface_hub..." -ForegroundColor Cyan
    py -m pip install -U huggingface_hub
    $script:HfCli = Join-Path $env:LOCALAPPDATA "Python\pythoncore-3.14-64\Scripts\hf.exe"
}

if ($Token) {
    $tokenArgs = @("--token", $Token)
}
else {
    $tokenArgs = @()
    Write-Host "If upload fails with 403, create a Hugging Face token with WRITE access and rerun with -Token YOUR_TOKEN." -ForegroundColor Yellow
}

Write-Host "Creating repo if needed..." -ForegroundColor Cyan
& $script:HfCli repo create $RepoId --type model --public --exist-ok @tokenArgs

Write-Host "Uploading files..." -ForegroundColor Cyan
& $script:HfCli upload $RepoId . . --repo-type model @tokenArgs

Write-Host "Done. Repo uploaded:" -ForegroundColor Green
Write-Host "https://huggingface.co/$RepoId"