Upload 2 files
Browse files
scripts/Model_downloader/Download-HIDREAM-Models.ps1
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
param(
|
2 |
+
[string]$InstallPath = $PSScriptRoot
|
3 |
+
)
|
4 |
+
|
5 |
+
<#
|
6 |
+
.SYNOPSIS
|
7 |
+
A PowerShell script to interactively download HiDream models for ComfyUI.
|
8 |
+
.DESCRIPTION
|
9 |
+
This version corrects the download logic for common files (VAE, CLIPs).
|
10 |
+
#>
|
11 |
+
|
12 |
+
#===========================================================================
|
13 |
+
# SECTION 1: HELPER FUNCTIONS & SETUP
|
14 |
+
#===========================================================================
|
15 |
+
function Write-Log { param([string]$Message, [string]$Color = "White") { $logFile = Join-Path $InstallPath "logs\install_log.txt"; $formattedMessage = "[$([DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))] [ModelDownloader-HiDream] $Message"; Write-Host $Message -ForegroundColor $Color; Add-Content -Path $logFile -Value $formattedMessage -ErrorAction SilentlyContinue; } }
|
16 |
+
function Invoke-AndLog { param([string]$File, [string]$Arguments) { $logFile = Join-Path $InstallPath "logs\install_log.txt"; $commandToRun = "`"$File`" $Arguments"; $cmdArguments = "/C `"$commandToRun >> `"`"$logFile`"`" 2>&1`""; try { Start-Process -FilePath "cmd.exe" -ArgumentList $cmdArguments -Wait -WindowStyle Hidden } catch { Write-Log "FATAL ERROR trying to execute command: $commandToRun" -Color Red } } }
|
17 |
+
function Download-File { param([string]$Uri, [string]$OutFile) { if (Test-Path $OutFile) { Write-Log "Skipping: $((Split-Path $OutFile -Leaf)) (already exists)." -Color Gray } else { $fileName = Split-Path -Path $Uri -Leaf; if (Get-Command 'aria2c' -ErrorAction SilentlyContinue) { Write-Log "Downloading: $fileName"; $aria_args = "-c -x 16 -s 16 -k 1M --dir=`"$((Split-Path $OutFile -Parent))`" --out=`"$((Split-Path $OutFile -Leaf))`" `"$Uri`""; Invoke-AndLog "aria2c" $aria_args } else { Write-Log "Aria2 not found. Falling back to standard download: $fileName" -Color Yellow; Invoke-WebRequest -Uri $Uri -OutFile $OutFile } } } }
|
18 |
+
function Ask-Question { param([string]$Prompt, [string[]]$Choices, [string[]]$ValidAnswers) { $choice = ''; while ($choice -notin $ValidAnswers) { Write-Log "`n$Prompt" -Color Yellow; foreach ($line in $Choices) { Write-Host " $line" -ForegroundColor Green }; $choice = (Read-Host "Enter your choice and press Enter").ToUpper(); if ($choice -notin $ValidAnswers) { Write-Log "Invalid choice. Please try again." -Color Red } }; return $choice } }
|
19 |
+
|
20 |
+
#===========================================================================
|
21 |
+
# SECTION 2: SCRIPT EXECUTION
|
22 |
+
#===========================================================================
|
23 |
+
|
24 |
+
$InstallPath = $InstallPath.Trim('"')
|
25 |
+
$comfyPath = Join-Path $InstallPath "ComfyUI"
|
26 |
+
$modelsPath = Join-Path $comfyPath "models"
|
27 |
+
if (-not (Test-Path $modelsPath)) { Write-Log "Could not find ComfyUI models path at '$modelsPath'. Exiting." -Color Red; Read-Host "Press Enter to exit."; exit }
|
28 |
+
|
29 |
+
# --- GPU Detection ---
|
30 |
+
Write-Log "-------------------------------------------------------------------------------"
|
31 |
+
Write-Log "Checking for NVIDIA GPU to provide model recommendations..." -Color Yellow
|
32 |
+
if (Get-Command 'nvidia-smi' -ErrorAction SilentlyContinue) {
|
33 |
+
try {
|
34 |
+
$gpuInfoCsv = nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
|
35 |
+
if ($gpuInfoCsv) {
|
36 |
+
$gpuInfoParts = $gpuInfoCsv.Split(','); $gpuName = $gpuInfoParts[0].Trim(); $gpuMemoryMiB = ($gpuInfoParts[1] -replace ' MiB').Trim(); $gpuMemoryGiB = [math]::Round([int]$gpuMemoryMiB / 1024)
|
37 |
+
Write-Log "GPU : $gpuName" -Color Green; Write-Log "VRAM : $gpuMemoryGiB GB" -Color Green
|
38 |
+
if ($gpuMemoryGiB -ge 24) { Write-Log "Recommandation: fp8" -Color Cyan } elseif ($gpuMemoryGiB -ge 16) { Write-Log "Recommandation: GGUF Q8_0" -Color Cyan } elseif ($gpuMemoryGiB -ge 12) { Write-Log "Recommandation: GGUF Q5_K_S" -Color Cyan } else { Write-Log "Recommandation: GGUF Q4_K_S" -Color Cyan }
|
39 |
+
}
|
40 |
+
} catch { Write-Log "Impossible de récupérer les informations GPU. Erreur: $($_.Exception.Message)" -Color Red }
|
41 |
+
} else { Write-Log "Aucun GPU NVIDIA detecte (nvidia-smi introuvable). Choisissez selon votre matériel." -Color Gray }
|
42 |
+
Write-Log "-------------------------------------------------------------------------------"
|
43 |
+
|
44 |
+
# --- Ask all questions ---
|
45 |
+
$fp8Choice = Ask-Question "Do you want to download HiDream fp8 models? (24GB Vram recommended)" @("A) Yes", "B) No") @("A", "B")
|
46 |
+
$ggufChoice = Ask-Question "Do you want to download HiDream GGUF models?" @("A) Q8_0 (16GB Vram)", "B) Q5_K_S (12GB Vram)", "C) Q4_K_S (less than 12GB Vram)", "D) All", "E) No") @("A", "B", "C", "D", "E")
|
47 |
+
|
48 |
+
# --- Download files based on answers ---
|
49 |
+
Write-Log "`nStarting HiDream model downloads..." -Color Cyan
|
50 |
+
$baseUrl = "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/models"
|
51 |
+
$hidreamDiffDir = Join-Path $modelsPath "diffusion_models\HIDREAM"
|
52 |
+
$hidreamUnetDir = Join-Path $modelsPath "unet\HIDREAM"
|
53 |
+
$clipDir = Join-Path $modelsPath "clip"
|
54 |
+
$vaeDir = Join-Path $modelsPath "vae"
|
55 |
+
New-Item -Path $hidreamDiffDir, $hidreamUnetDir, $clipDir, $vaeDir -ItemType Directory -Force | Out-Null
|
56 |
+
|
57 |
+
# === CORRECTION : Déterminer si un téléchargement est nécessaire ===
|
58 |
+
$doDownload = ($fp8Choice -eq 'A' -or $ggufChoice -ne 'E')
|
59 |
+
|
60 |
+
# Télécharger les fichiers communs si nécessaire
|
61 |
+
if ($doDownload) {
|
62 |
+
Write-Log "`nDownloading HiDream common support files (VAE, CLIPs)..."
|
63 |
+
Download-File -Uri "$baseUrl/vae/ae.safetensors?download=true" -OutFile (Join-Path $vaeDir "ae.safetensors")
|
64 |
+
Download-File -Uri "$baseUrl/clip/clip_g_hidream.safetensors?download=true" -OutFile (Join-Path $clipDir "clip_g_hidream.safetensors")
|
65 |
+
Download-File -Uri "$baseUrl/clip/clip_l_hidream.safetensors?download=true" -OutFile (Join-Path $clipDir "clip_l_hidream.safetensors")
|
66 |
+
Download-File -Uri "$baseUrl/clip/t5xxl_fp8_e4m3fn_scaled.safetensors?download=true" -OutFile (Join-Path $clipDir "t5xxl_fp8_e4m3fn_scaled.safetensors")
|
67 |
+
Download-File -Uri "$baseUrl/clip/llama_3.1_8b_instruct_fp8_scaled.safetensors?download=true" -OutFile (Join-Path $clipDir "llama_3.1_8b_instruct_fp8_scaled.safetensors")
|
68 |
+
}
|
69 |
+
|
70 |
+
# fp8 Model (uniquement le modèle principal)
|
71 |
+
if ($fp8Choice -eq 'A') {
|
72 |
+
Write-Log "`nDownloading HiDream fp8 model..."
|
73 |
+
Download-File -Uri "$baseUrl/diffusion_models/HiDream/hidream_i1_dev_fp8.safetensors?download=true" -OutFile (Join-Path $hidreamDiffDir "hidream_i1_dev_fp8.safetensors")
|
74 |
+
}
|
75 |
+
|
76 |
+
# GGUF Models
|
77 |
+
if ($ggufChoice -ne 'E') {
|
78 |
+
Write-Log "`nDownloading HiDream GGUF models..."
|
79 |
+
if ($ggufChoice -in 'A', 'D') { Download-File -Uri "$baseUrl/unet/HiDream/hidream-i1-dev-Q8_0.gguf?download=true" -OutFile (Join-Path $hidreamUnetDir "hidream-i1-dev-Q8_0.gguf") }
|
80 |
+
if ($ggufChoice -in 'B', 'D') { Download-File -Uri "$baseUrl/unet/HiDream/hidream-i1-dev-Q5_K_S.gguf?download=true" -OutFile (Join-Path $hidreamUnetDir "hidream-i1-dev-Q5_K_S.gguf") }
|
81 |
+
if ($ggufChoice -in 'C', 'D') { Download-File -Uri "$baseUrl/unet/HiDream/hidream-i1-dev-Q4_K_S.gguf?download=true" -OutFile (Join-Path $hidreamUnetDir "hidream-i1-dev-Q4_K_S.gguf") }
|
82 |
+
}
|
83 |
+
|
84 |
+
Write-Log "`nHiDream model downloads complete." -Color Green
|
85 |
+
Read-Host "Press Enter to return to the main installer."
|
scripts/Model_downloader/Download-LTXV-Models.ps1
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
param(
|
2 |
+
[string]$InstallPath = $PSScriptRoot
|
3 |
+
)
|
4 |
+
|
5 |
+
<#
|
6 |
+
.SYNOPSIS
|
7 |
+
A PowerShell script to interactively download LTX-Video models for ComfyUI.
|
8 |
+
.DESCRIPTION
|
9 |
+
This version corrects the download logic for the common VAE file.
|
10 |
+
#>
|
11 |
+
|
12 |
+
#===========================================================================
|
13 |
+
# SECTION 1: HELPER FUNCTIONS & SETUP
|
14 |
+
#===========================================================================
|
15 |
+
function Write-Log { param([string]$Message, [string]$Color = "White") { $logFile = Join-Path $InstallPath "logs\install_log.txt"; $formattedMessage = "[$([DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))] [ModelDownloader-LTXV] $Message"; Write-Host $Message -ForegroundColor $Color; Add-Content -Path $logFile -Value $formattedMessage -ErrorAction SilentlyContinue; } }
|
16 |
+
function Invoke-AndLog { param([string]$File, [string]$Arguments) { $logFile = Join-Path $InstallPath "logs\install_log.txt"; $commandToRun = "`"$File`" $Arguments"; $cmdArguments = "/C `"$commandToRun >> `"`"$logFile`"`" 2>&1`""; try { Start-Process -FilePath "cmd.exe" -ArgumentList $cmdArguments -Wait -WindowStyle Hidden } catch { Write-Log "FATAL ERROR trying to execute command: $commandToRun" -Color Red } } }
|
17 |
+
function Download-File { param([string]$Uri, [string]$OutFile) { if (Test-Path $OutFile) { Write-Log "Skipping: $((Split-Path $OutFile -Leaf)) (already exists)." -Color Gray } else { $fileName = Split-Path -Path $Uri -Leaf; if (Get-Command 'aria2c' -ErrorAction SilentlyContinue) { Write-Log "Downloading: $fileName"; $aria_args = "-c -x 16 -s 16 -k 1M --dir=`"$((Split-Path $OutFile -Parent))`" --out=`"$((Split-Path $OutFile -Leaf))`" `"$Uri`""; Invoke-AndLog "aria2c" $aria_args } else { Write-Log "Aria2 not found. Falling back to standard download: $fileName" -Color Yellow; Invoke-WebRequest -Uri $Uri -OutFile $OutFile } } } }
|
18 |
+
function Ask-Question { param([string]$Prompt, [string[]]$Choices, [string[]]$ValidAnswers) { $choice = ''; while ($choice -notin $ValidAnswers) { Write-Log "`n$Prompt" -Color Yellow; foreach ($line in $Choices) { Write-Host " $line" -ForegroundColor Green }; $choice = (Read-Host "Enter your choice and press Enter").ToUpper(); if ($choice -notin $ValidAnswers) { Write-Log "Invalid choice. Please try again." -Color Red } }; return $choice } }
|
19 |
+
|
20 |
+
#===========================================================================
|
21 |
+
# SECTION 2: SCRIPT EXECUTION
|
22 |
+
#===========================================================================
|
23 |
+
|
24 |
+
$InstallPath = $InstallPath.Trim('"')
|
25 |
+
$comfyPath = Join-Path $InstallPath "ComfyUI"
|
26 |
+
$modelsPath = Join-Path $comfyPath "models"
|
27 |
+
if (-not (Test-Path $modelsPath)) { Write-Log "Could not find ComfyUI models path at '$modelsPath'. Exiting." -Color Red; Read-Host "Press Enter to exit."; exit }
|
28 |
+
|
29 |
+
# --- GPU Detection ---
|
30 |
+
Write-Log "-------------------------------------------------------------------------------"
|
31 |
+
Write-Log "Checking for NVIDIA GPU to provide model recommendations..." -Color Yellow
|
32 |
+
if (Get-Command 'nvidia-smi' -ErrorAction SilentlyContinue) {
|
33 |
+
try {
|
34 |
+
$gpuInfoCsv = nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
|
35 |
+
if ($gpuInfoCsv) {
|
36 |
+
$gpuInfoParts = $gpuInfoCsv.Split(','); $gpuName = $gpuInfoParts[0].Trim(); $gpuMemoryMiB = ($gpuInfoParts[1] -replace ' MiB').Trim(); $gpuMemoryGiB = [math]::Round([int]$gpuMemoryMiB / 1024)
|
37 |
+
Write-Log "GPU : $gpuName" -Color Green; Write-Log "VRAM : $gpuMemoryGiB GB" -Color Green
|
38 |
+
if ($gpuMemoryGiB -ge 30) { Write-Log "Recommandation: 13B Base Model" -Color Cyan } elseif ($gpuMemoryGiB -ge 24) { Write-Log "Recommandation: GGUF Q8_0" -Color Cyan } elseif ($gpuMemoryGiB -ge 16) { Write-Log "Recommandation: GGUF Q5_K_M" -Color Cyan } else { Write-Log "Recommandation: 2B Base Model ou GGUF Q3_K_S" -Color Cyan }
|
39 |
+
}
|
40 |
+
} catch { Write-Log "Impossible de récupérer les informations GPU. Erreur: $($_.Exception.Message)" -Color Red }
|
41 |
+
} else { Write-Log "Aucun GPU NVIDIA detecte (nvidia-smi introuvable). Choisissez selon votre matériel." -Color Gray }
|
42 |
+
Write-Log "-------------------------------------------------------------------------------"
|
43 |
+
|
44 |
+
# --- Ask all questions ---
|
45 |
+
$baseChoice = Ask-Question "Do you want to download LTXV base models?" @("A) 13B (30Gb)", "B) 2B (7Gb)", "C) All", "D) No") @("A", "B", "C", "D")
|
46 |
+
$ggufChoice = Ask-Question "Do you want to download LTXV GGUF models?" @("A) Q8_0 (24GB Vram)", "B) Q5_K_M (16GB Vram)", "C) Q3_K_S (less than 12GB Vram)", "D) All", "E) No") @("A", "B", "C", "D", "E")
|
47 |
+
|
48 |
+
# --- Download files based on answers ---
|
49 |
+
Write-Log "`nStarting LTX-Video model downloads..." -Color Cyan
|
50 |
+
$baseUrl = "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/models"
|
51 |
+
$ltxvChkptDir = Join-Path $modelsPath "checkpoints\LTXV"
|
52 |
+
$ltxvUnetDir = Join-Path $modelsPath "unet\LTXV"
|
53 |
+
$vaeDir = Join-Path $modelsPath "vae"
|
54 |
+
New-Item -Path $ltxvChkptDir, $ltxvUnetDir, $vaeDir -ItemType Directory -Force | Out-Null
|
55 |
+
|
56 |
+
# === CORRECTION : Déterminer si un téléchargement est nécessaire pour les fichiers communs ===
|
57 |
+
$doDownload = ($baseChoice -ne 'D' -or $ggufChoice -ne 'E')
|
58 |
+
|
59 |
+
# Télécharger le VAE commun si N'IMPORTE QUEL modèle est sélectionné
|
60 |
+
if ($doDownload) {
|
61 |
+
Write-Log "`nDownloading LTXV common support file (VAE)..."
|
62 |
+
Download-File -Uri "$baseUrl/vae/ltxv-13b-0.9.7-vae-BF16.safetensors?download=true" -OutFile (Join-Path $vaeDir "ltxv-13b-0.9.7-vae-BF16.safetensors")
|
63 |
+
}
|
64 |
+
|
65 |
+
# Base Models (uniquement les checkpoints)
|
66 |
+
if ($baseChoice -ne 'D') {
|
67 |
+
Write-Log "`nDownloading LTXV base model(s)..."
|
68 |
+
if ($baseChoice -in 'A', 'C') {
|
69 |
+
Download-File -Uri "$baseUrl/checkpoints/LTXV/ltxv-13b-0.9.7-dev.safetensors?download=true" -OutFile (Join-Path $ltxvChkptDir "ltxv-13b-0.9.7-dev.safetensors")
|
70 |
+
}
|
71 |
+
if ($baseChoice -in 'B', 'C') {
|
72 |
+
Download-File -Uri "$baseUrl/checkpoints/LTXV/ltxv-2b-0.9.6-dev-04-25.safetensors?download=true" -OutFile (Join-Path $ltxvChkptDir "ltxv-2b-0.9.6-dev-04-25.safetensors")
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
# GGUF Models
|
77 |
+
if ($ggufChoice -ne 'E') {
|
78 |
+
Write-Log "`nDownloading LTXV GGUF models..."
|
79 |
+
if ($ggufChoice -in 'A', 'D') { Download-File -Uri "$baseUrl/unet/LTXV/ltxv-13b-0.9.7-dev-Q8_0.gguf?download=true" -OutFile (Join-Path $ltxvUnetDir "ltxv-13b-0.9.7-dev-Q8_0.gguf") }
|
80 |
+
if ($ggufChoice -in 'B', 'D') { Download-File -Uri "$baseUrl/unet/LTXV/ltxv-13b-0.9.7-dev-Q5_K_M.gguf?download=true" -OutFile (Join-Path $ltxvUnetDir "ltxv-13b-0.9.7-dev-Q5_K_M.gguf") }
|
81 |
+
if ($ggufChoice -in 'C', 'D') { Download-File -Uri "$baseUrl/unet/LTXV/ltxv-13b-0.9.7-dev-Q3_K_S.gguf?download=true" -OutFile (Join-Path $ltxvUnetDir "ltxv-13b-0.9.7-dev-Q3_K_S.gguf") }
|
82 |
+
}
|
83 |
+
|
84 |
+
Write-Log "`nLTX-Video model downloads complete." -Color Green
|
85 |
+
Read-Host "Press Enter to return to the main installer."
|