mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-07-12 11:01:09 +08:00
99 lines
3.2 KiB
PowerShell
99 lines
3.2 KiB
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
Write-Host "Current location: $(Get-Location)"
|
|
|
|
$cuda = $env:TORCH_CUDA
|
|
if (-not $cuda) {
|
|
Write-Error "Missing TORCH_CUDA env (cu124 or cu128)"
|
|
exit 1
|
|
}
|
|
|
|
$date = $env:DATE_SUFFIX
|
|
if ([string]::IsNullOrWhiteSpace($date)) {
|
|
$date = Get-Date -Format "MMdd"
|
|
}
|
|
|
|
$pkgName = "GPT-SoVITS-$date"
|
|
$tmpDir = "tmp"
|
|
$srcDir = $PWD
|
|
|
|
$suffix = $env:PKG_SUFFIX
|
|
if (-not [string]::IsNullOrWhiteSpace($suffix)) {
|
|
$pkgName = "$pkgName$suffix"
|
|
}
|
|
|
|
$pkgName = "$pkgName-$cuda"
|
|
|
|
Write-Host "[INFO] Cleaning .git..."
|
|
Remove-Item "$srcDir\.git" -Recurse -Force -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "[INFO] Creating tmp dir..."
|
|
New-Item -ItemType Directory -Force -Path $tmpDir
|
|
|
|
Write-Host "[INFO] System Python version:"
|
|
python --version
|
|
python -m site
|
|
|
|
Write-Host "[INFO] Preparing final directory $pkgName ..."
|
|
$items = @(Get-ChildItem -Filter "*.sh") +
|
|
@(Get-ChildItem -Filter "*.ipynb") +
|
|
@("$tmpDir", ".github", "Docker", "docs", ".gitignore", ".dockerignore", "README.md")
|
|
Remove-Item $items -Force -Recurse -ErrorAction SilentlyContinue
|
|
|
|
$curr = Get-Location
|
|
Set-Location ../
|
|
Get-ChildItem .
|
|
Copy-Item -Path $curr -Destination $pkgName -Recurse
|
|
|
|
$7zPath = "$pkgName.7z"
|
|
$start = Get-Date
|
|
Write-Host "Compress Starting at $start"
|
|
& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=5 -md=256m -ms=on -mmt=on -bsp1
|
|
$end = Get-Date
|
|
Write-Host "Elapsed time: $($end - $start)"
|
|
|
|
$config = @"
|
|
;!@Install@!UTF-8!
|
|
Title="GPT-SoVITS Installation"
|
|
BeginPrompt="本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责 / This software is open-sourced under the MIT license. The author has no control over it. Users and distributors of the generated voices are solely responsible."
|
|
ExtractPath="."
|
|
;!@InstallEnd@!
|
|
"@
|
|
Set-Content -Path "config.txt" -Value $config -Encoding UTF8
|
|
|
|
# $SfxModule = "C:\Program Files\7-Zip\7z.sfx"
|
|
# $SfxExePath = "$pkgName.exe"
|
|
# Write-Host "[INFO] Creating self-extracting archive: $SfxExePath"
|
|
Get-ChildItem .
|
|
$cmd = 'copy /b "{0}"+"config.txt"+"{1}" "{2}"' -f $SfxModule, $7zPath, $SfxExePath
|
|
Write-Host "[INFO] Running CMD: $cmd"
|
|
cmd /c $cmd
|
|
|
|
$cmd = 'copy /b "{0}" + "{1}" "{2}"' -f $SfxModule, $7zPath, $SfxExePath
|
|
Write-Host "[INFO] Running CMD: $cmd"
|
|
cmd /c $cmd
|
|
|
|
python -m pip install --upgrade pip
|
|
python -m pip install "modelscope" "huggingface_hub[hf_transfer]" --no-warn-script-location
|
|
|
|
Write-Host "[INFO] Uploading to ModelScope..."
|
|
$msUser = $env:MODELSCOPE_USERNAME
|
|
$msToken = $env:MODELSCOPE_TOKEN
|
|
if (-not $msUser -or -not $msToken) {
|
|
Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN"
|
|
exit 1
|
|
}
|
|
modelscope upload "$msUser/GPT-SoVITS-Packages" "$SfxExePath" "$SfxExePath" --repo-type model --token $msToken
|
|
Write-Host "[SUCCESS] Uploaded: $SfxExePath to ModelScope"
|
|
|
|
Write-Host "[INFO] Uploading to HuggingFace..."
|
|
$hfUser = $env:HUGGINGFACE_USERNAME
|
|
$hfToken = $env:HUGGINGFACE_TOKEN
|
|
if (-not $hfUser -or -not $hfToken) {
|
|
Write-Error "Missing HUGGINGFACE_USERNAME or HUGGINGFACE_TOKEN"
|
|
exit 1
|
|
}
|
|
$env:HF_HUB_ENABLE_HF_TRANSFER = "1"
|
|
huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$SfxExePath" "$SfxExePath" --repo-type model --token $hfToken
|
|
Write-Host "[SUCCESS] Uploaded: $SfxExePath to HuggingFace"
|