Run this model with HF Jobs
Run UmeAiRT/ComfyUI-Auto-Installer-Assets on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use UmeAiRT/ComfyUI-Auto-Installer-Assets with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use UmeAiRT/ComfyUI-Auto-Installer-Assets with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("UmeAiRT/ComfyUI-Auto-Installer-Assets", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload Install-ComfyUI.ps1
Browse files1234562 unmodified lines910111213141516171819202122232425262728293031323334353637383940414243444546472 unmodified lines5051525354555657585960616263646566671 unmodified line6970717273747576777879808182838485868788899091929394959697987 unmodified lines1061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371384 unmodified lines14314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423520 unmodified lines256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416#Requires -RunAsAdministrator# --- NOUVEAU : Définition des paramètres du script ---param(# Définit le chemin d'installation.# Si le script est lancé sans cet argument, il utilisera son propre dossier par défaut.2 unmodified lines<#.SYNOPSISA complete, all-in-one installer for ComfyUI and its environment..DESCRIPTIONThis script can be run standalone or from a launcher. It accepts an -InstallPathparameter to define the installation directory..NOTESAuthor: Code Partner (based on original scripts and user feedback)Version: 6.0 (Flexible Install Path)#>#===========================================================================# SECTION 1: SCRIPT CONFIGURATION & HELPER FUNCTIONS#===========================================================================# On retire les guillemets que le .bat pourrait ajouter à l'argument$InstallPath = $InstallPath.Trim('"')# --- Force TLS 1.2 for all web requests ---[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12# --- Path & Log Variables ---# Le chemin d'installation est maintenant déterminé par le paramètre -InstallPath$basePath = Join-Path $InstallPath "ComfyUI_windows_portable"$comfyPath = Join-Path $basePath "ComfyUI"$pythonExecutable = Join-Path $basePath "python_embeded\python.exe"$customNodesPath = Join-Path $comfyPath "custom_nodes"$logPath = Join-Path $InstallPath "scripts\logs"$logFile = Join-Path $logPath "install_log.txt"$sevenZipPath = "C:\Program Files\7-Zip\7z.exe" # Default path# --- Create Log Directory ---if (-not (Test-Path $logPath)) {New-Item -ItemType Directory -Force -Path $logPath | Out-Null}# --- Helper function to write to console and log file ---function Write-Log {param([string]$Message, [string]$Color = "White")$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"2 unmodified linesAdd-Content -Path $logFile -Value $formattedMessage}# --- Helper function to execute a command and log its output (VERSION-COMPATIBLE) ---function Invoke-AndLog {param([string]$File,[string]$Arguments)# This method is compatible with all PowerShell versions, including 5.1.# It uses cmd.exe to run the command and handle output redirection.# The structure is: cmd /c "full command >> "path/to/log.txt" 2>&1"$commandToRun = "`"$File`" $Arguments"$cmdArguments = "/C `"$commandToRun >> `"`"$logFile`"`" 2>&1`""try {Start-Process -FilePath "cmd.exe" -ArgumentList $cmdArguments -Wait -WindowStyle Hidden} catch {1 unmodified line}}# --- Function to install the aria2 binary directly ---function Install-Aria2-Binary {Write-Log "--- Starting Aria2 binary installation ---" -Color Magenta$destFolder = "C:\Tools\aria2"if (-not (Test-Path $destFolder)) { New-Item -ItemType Directory -Force -Path $destFolder | Out-Null }$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-64bit-build1.zip"$zipPath = Join-Path $env:TEMP "aria2_temp.zip"Write-Log "Downloading aria2 from $aria2Url..."Invoke-WebRequest -Uri $aria2Url -OutFile $zipPathWrite-Log "Extracting zip file to $destFolder..."Expand-Archive -Path $zipPath -DestinationPath $destFolder -Force$extractedSubfolder = Join-Path $destFolder "aria2-1.36.0-win-64bit-build1"if (Test-Path $extractedSubfolder) {Move-Item -Path (Join-Path $extractedSubfolder "*") -Destination $destFolder -ForceRemove-Item -Path $extractedSubfolder -Recurse -Force}$configFile = Join-Path $destFolder "aria2.conf"$configContent = "continue=true`nmax-connection-per-server=16`nsplit=16`nmin-split-size=1M`nfile-allocation=none"$configContent | Out-File $configFile -Encoding UTF8$envScope = "User"$oldPath = [System.Environment]::GetEnvironmentVariable("Path", $envScope)if ($oldPath -notlike "*$destFolder*") {7 unmodified lines}# --- Smart Download Function with fallback ---function Download-File {param([string]$Uri,[string]$OutFile)# Extrait juste le nom du fichier de l'URL pour un affichage plus propre$fileName = Split-Path -Path $Uri -Leafif (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 YellowInvoke-WebRequest -Uri $Uri -OutFile $OutFile}}#===========================================================================# SECTION 2: MAIN SCRIPT EXECUTION#===========================================================================Clear-Host# --- Banner ---# The ASCII art is now embedded directly in the script for simplicity and reliability.Write-Log "-------------------------------------------------------------------------------"$asciiBanner = @'__ __ ___ _ ____ ______4 unmodified lines'@Write-Host $asciiBanner -ForegroundColor CyanWrite-Log "-------------------------------------------------------------------------------"Write-Log " ComfyUI - All-in-One Installer " -Color YellowWrite-Log " Version 3.0 " -Color WhiteWrite-Log "-------------------------------------------------------------------------------"# --- Step 1: Install Dependencies (Aria2, 7-Zip, Git) ---Write-Log "Step 1: Checking for required tools..." -Color Yellow# Aria2if (-not (Get-Command 'aria2c' -ErrorAction SilentlyContinue)) {Write-Log "Aria2 not found. Proceeding with direct installation."Install-Aria2-Binary} else {Write-Log "Aria2 is already installed." -Color Green}# 7-Zipif (-not (Test-Path $sevenZipPath)) {Write-Log "7-Zip not found. Downloading and installing..."$sevenZipInstaller = Join-Path $env:TEMP "7z-installer.exe"Download-File -Uri "https://www.7-zip.org/a/7z2201-x64.exe" -OutFile $sevenZipInstallerStart-Process -FilePath $sevenZipInstaller -ArgumentList "/S" -WaitRemove-Item $sevenZipInstaller} else {Write-Log "7-Zip is already installed." -Color Green}# Gitif (-not (Get-Command git.exe -ErrorAction SilentlyContinue)) {Write-Log "Git not found. Downloading and installing..."$gitInstaller = Join-Path $env:TEMP "Git-Installer.exe"Download-File -Uri "https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.3/Git-2.41.0.3-64-bit.exe" -OutFile $gitInstallerStart-Process -FilePath $gitInstaller -ArgumentList "/VERYSILENT" -WaitRemove-Item $gitInstaller}Invoke-AndLog "git" "config --system core.longpaths true"Write-Log "Git is ready." -Color GreenWrite-Log "Install Visual Studio Build Tools." -Color Greenwinget install --id Microsoft.VisualStudio.2022.BuildTools -e --source winget --override "--quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.20348"# --- Step 2: Download and Extract ComfyUI ---Write-Log "`nStep 2: Downloading and setting up ComfyUI..." -Color Yellowif (-not (Test-Path $basePath)) {$comfyArchive = Join-Path $installPath "ComfyUI_windows_portable_nvidia.7z"Download-File -Uri "https://github.com/comfyanonymous/ComfyUI/releases/download/v0.3.43/ComfyUI_windows_portable_nvidia.7z" -OutFile $comfyArchiveWrite-Log " - Extracting ComfyUI..."Invoke-AndLog "$sevenZipPath" "x `"$comfyArchive`" -o`"$installPath`" -y"Remove-Item $comfyArchive} else {Write-Log "ComfyUI folder already exists. Skipping download." -Color Green}# --- Step 3: Update ComfyUI and Install Custom Nodes ---Write-Log "`nStep 3: Updating ComfyUI and installing custom nodes..." -Color Yellow# Update pip and ComfyUI itselfInvoke-AndLog "$pythonExecutable" "-m pip install --upgrade pip"Invoke-AndLog "$pythonExecutable" "`"$basePath\update\update.py`" `"$comfyPath`""Invoke-AndLog "$pythonExecutable" "-s -m pip install -r `"$comfyPath\requirements.txt`""# Install special Python dependenciesWrite-Log " - Installing special Python dependencies" -Color WhiteInvoke-AndLog "$pythonExecutable" "-s -m pip install ultralytics wheel-stub --no-warn-script-location"$insightfaceWheel = Join-Path $basePath "python_embeded\insightface-0.7.3-cp312-cp312-win_amd64.whl"Download-File -Uri "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/whl/insightface-0.7.3-cp312-cp312-win_amd64.whl" -OutFile $insightfaceWheelInvoke-AndLog "$pythonExecutable" "-m pip install --use-pep517 facexlib"Invoke-AndLog "$pythonExecutable" "-m pip install git+https://github.com/rodjjo/filterpy.git"Invoke-AndLog "$pythonExecutable" "-m pip install onnxruntime==1.19.2 onnxruntime-gpu==1.17.1"Invoke-AndLog "$pythonExecutable" "-s -m pip install $insightfaceWheel --no-warn-script-location"Write-Log " - Installing Python include/libs for compatibility..." -Color Cyan$pyLibsUrl = "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/python_3.12.9_include_libs.zip"$zipPath = Join-Path $installPath "python_libs.zip"$extractPath = Join-Path $basePath "python_embeded"# Télécharge le fichier zipDownload-File -Uri $pyLibsUrl -OutFile $zipPath# Extrait le contenu et nettoie l'archiveif (Test-Path $zipPath) {try {Write-Log " - Extracting python libs to '$extractPath'..."Expand-Archive -Path $zipPath -DestinationPath $extractPath -ForceWrite-Log " - Extraction complete." -Color Green} catch {Write-Log " - FAILED to extract python libs. Error: $($_.Exception.Message)" -Color Red} finally {Remove-Item -Path $zipPath -Force}}# Define all custom nodes in one place$customNodes = @(@{Name="ComfyUI-Manager"; Repo="https://github.com/ltdrdata/ComfyUI-Manager.git"; HasRequirements=$false},@{Name="ComfyUI-Impact-Pack"; Repo="https://github.com/ltdrdata/ComfyUI-Impact-Pack"; HasRequirements=$true},20 unmodified lines@{Name="ComfyUI-RMBG"; Repo="https://github.com/1038lab/ComfyUI-RMBG"; HasRequirements=$true},@{Name="ComfyUI-Detail-Daemon"; Repo="https://github.com/Jonseed/ComfyUI-Detail-Daemon"; HasRequirements=$true},@{Name="ComfyUI-TeaCache"; Repo="https://github.com/welltop-cn/ComfyUI-TeaCache"; HasRequirements=$true},@{Name="ComfyUI-Crystools"; Repo="https://github.com/crystian/ComfyUI-Crystools"; HasRequirements=$true},@{Name="ComfyUI-Upscaler-Tensorrt"; Repo="https://github.com/yuvraj108c/ComfyUI-Upscaler-Tensorrt"; HasRequirements=$true})# Loop through and install each custom nodeforeach ($node in $customNodes) {$nodePath = if ($node.Subfolder) { Join-Path $customNodesPath $node.Subfolder } else { Join-Path $customNodesPath $node.Name }if (-not (Test-Path $nodePath)) {Write-Log " - Installing $($node.Name)..."# For sub-repositories, clone into the parent directory$cloneTargetPath = if ($node.Subfolder) { (Split-Path $nodePath -Parent) } else { $nodePath }# Special case for subpack which needs a specific final directory name$finalDirName = if ($node.Name -eq 'ComfyUI-Impact-Subpack') { 'impact_subpack' } else { $node.Name }$cloneCommand = "clone $($node.Repo) `"$((Join-Path (Split-Path $cloneTargetPath -Parent) $finalDirName))`""Invoke-AndLog "git" "clone $($node.Repo) `"$cloneTargetPath`""if ($node.HasRequirements) {$requirementsFile = if ($node.RequirementsFile) { $node.RequirementsFile } else { "requirements.txt" }$reqPath = Join-Path $nodePath $requirementsFileif (Test-Path $reqPath) {Invoke-AndLog "$pythonExecutable" "-s -m pip install -r `"$reqPath`" --no-warn-script-location"}}} else {Write-Log " - $($node.Name) (already exists, skipping)" -Color Green}}# Install supplementary performance modulesWrite-Log "`nStep 4: Installing supplementary performance modules..." -Color Yellow# TritonWrite-Log " - Installing Triton..."$tritonWheel = Join-Path $basePath "python_embeded\triton-3.3.0-py3-none-any.whl"Download-File -Uri "https://github.com/woct0rdho/triton-windows/releases/download/empty/triton-3.3.0-py3-none-any.whl" -OutFile $tritonWheelInvoke-AndLog "$pythonExecutable" "-m pip install `"$tritonWheel`""Invoke-AndLog "$pythonExecutable" "-s -m pip install triton-windows"# xformersWrite-Log " - Installing xformers..."Invoke-AndLog "$pythonExecutable" "-m pip install -U xformers --index-url https://download.pytorch.org/whl/cu128"Write-Log " - Checking xformers files for compatibility (looking for file named 'pyd')..."$xformersBaseDir = Join-Path $basePath "python_embeded\Lib\site-packages\xformers"$dirsToProcess = @($xformersBaseDir,(Join-Path $xformersBaseDir "flash_attn_3"))foreach ($dir in $dirsToProcess) {Write-Log " - Checking directory: $dir"if (Test-Path $dir) {# On vérifie l'existence d'un fichier nommé EXACTEMENT "pyd"$exactFilePath = Join-Path $dir "pyd"if (Test-Path $exactFilePath) {# Le fichier existe, on le renomme.Write-Log " - Found file named 'pyd'. Renaming to '_C.pyd'..." -Color Yellow$newName = "_C.pyd"try {Rename-Item -Path $exactFilePath -NewName $newName -Force -ErrorAction StopWrite-Log " - SUCCESS: Renamed 'pyd' to '$newName'" -Color Green} catch {Write-Log " - FAILED to rename. Error: $($_.Exception.Message)" -Color Red}} else {# Le fichier 'pyd' n'a pas été trouvé. On vérifie si '_C.pyd' existe déjà.$finalFilePath = Join-Path $dir "_C.pyd"if (Test-Path $finalFilePath) {Write-Log " - File '_C.pyd' already exists. No action needed." -Color Green} else {Write-Log " - No file named 'pyd' or '_C.pyd' found in this directory." -Color Gray}}} else {# Le répertoire lui-même n'existe pas.Write-Log " - Directory not found. Skipping." -Color Gray}}# SageAttentionWrite-Log " - Installing SageAttention..."$sageWheel = Join-Path $basePath "python_embeded\sageattention-2.1.1+cu128torch2.7.0-cp312-cp312-win_amd64.whl"Download-File -Uri "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/whl/sageattention-2.1.1+cu128torch2.7.0-cp312-cp312-win_amd64.whl" -OutFile $sageWheelInvoke-AndLog "$pythonExecutable" "-m pip install `"$sageWheel`""# --- Step 5: Download Custom Workflows ---Write-Log "`nStep 5: Downloading UmeAiRT Workflows..." -Color Yellow$workflowPath = Join-Path $comfyPath "user\default\workflows"$cloneDest = Join-Path $workflowPath "UmeAiRT-Workflow"# Create the target directory if it doesn't existif (-not (Test-Path $workflowPath)) {Write-Log " - Creating workflow directory: $workflowPath"New-Item -Path $workflowPath -ItemType Directory -Force | Out-Null}# Clone the workflow repository if it doesn't already existif (-not (Test-Path $cloneDest)) {Write-Log " - Cloning workflows from GitHub into '$cloneDest'..."Invoke-AndLog "git" "clone https://github.com/UmeAiRT/ComfyUI-Workflows `"$cloneDest`""Write-Log " - Workflows downloaded successfully." -Color Green} else {Write-Log " - Workflow directory already exists. Skipping download." -Color Green}Write-Log "`nStep 7: Optional ComfyUI options..." -Color Yellow$settingsPath = Join-Path $comfyPath "user\default\comfy.settings.json"Download-File -Uri "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/comfy.settings.json" -OutFile $settingsPath# --- Step 6: Optional Model Pack Downloads ---Write-Log "`nStep 8: Optional Model Pack Downloads..." -Color Yellow# Définition des packs de modèles et de leurs scripts PowerShell correspondants$modelPacks = @(@{Name="FLUX"; ScriptName="Download-FLUX-Models.ps1"}# Ajoutez ici les autres packs de modèles (WAN, HIDREAM, etc.))# === CORRECTION : On définit le chemin vers le dossier des scripts ===$scriptsSubFolder = Join-Path $InstallPath "scripts"# Boucle pour chaque pack de modèlesforeach ($pack in $modelPacks) {# On construit le chemin complet en utilisant le dossier des scripts$scriptPath = Join-Path $scriptsSubFolder $pack.ScriptNameif (-not (Test-Path $scriptPath)) {Write-Log "Model downloader script not found: '$($pack.ScriptName)'. Skipping." -Color Redcontinue # Passe au pack suivant}$validInput = $falsewhile (-not $validInput) {Write-Host "`n[33mWould you like to download $($pack.Name) models? (Y/N)[0m"$choice = Read-Hostif ($choice -eq 'Y' -or $choice -eq 'y') {Write-Log " - Launching downloader for $($pack.Name) models..." -Color Green# Exécute le script PowerShell de téléchargement& $scriptPath -InstallPath $InstallPath$validInput = $true} elseif ($choice -eq 'N' -or $choice -eq 'n') {Write-Log " - Skipping download for $($pack.Name) models." -Color Gray$validInput = $true} else {Write-Host " [31mInvalid choice. Please enter Y or N.[0m"}}}#===========================================================================# SECTION 7: FINALIZATION#===========================================================================Write-Log "-------------------------------------------------------------------------------" -Color GreenWrite-Log "Installation of ComfyUI and all nodes is complete!" -Color Green1234562 unmodified lines910111213141516171819202122232425262728293031323334353637383940414243444546474849502 unmodified lines535455565758596061621 unmodified line6465666768697071727374757677787980818283848586878889909192939495969798991001011021037 unmodified lines1111121131141151161171181191201211224 unmodified lines12712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320 unmodified lines224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299#Requires -RunAsAdministrator# --- Paramètres du script ---param(# Définit le chemin d'installation.# Si le script est lancé sans cet argument, il utilisera son propre dossier par défaut.2 unmodified lines<#.SYNOPSISA professional installer for ComfyUI using Git and a Python venv..DESCRIPTIONThis script provides a clean, modern installation of ComfyUI by:1. Checking for and installing Python 3.12 if needed.2. Cloning the official ComfyUI repository.3. Creating a dedicated Python virtual environment (venv).4. Installing all dependencies into the venv.5. Creating a launcher to run the application easily..NOTESAuthor: Code PartnerVersion: 7.0 (Git + Venv Architecture)#>#===========================================================================# SECTION 1: SCRIPT CONFIGURATION & HELPER FUNCTIONS#===========================================================================# --- Nettoyage et configuration des chemins ---$InstallPath = $InstallPath.Trim('"')[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12# Le chemin de base est maintenant le dossier d'installation principal.$comfyPath = Join-Path $InstallPath "ComfyUI"$logPath = Join-Path $InstallPath "logs"$logFile = Join-Path $logPath "install_log.txt"$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"# Variable qui contiendra le chemin vers le python du venv$venvPython = Join-Path $comfyPath "venv\Scripts\python.exe"# --- Create Log Directory ---if (-not (Test-Path $logPath)) {New-Item -ItemType Directory -Force -Path $logPath | Out-Null}# --- Helper functions ---function Write-Log {param([string]$Message, [string]$Color = "White")$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"2 unmodified linesAdd-Content -Path $logFile -Value $formattedMessage}function Invoke-AndLog {param([string]$File, [string]$Arguments)$commandToRun = "`"$File`" $Arguments"$cmdArguments = "/C `"$commandToRun >> `"`"$logFile`"`" 2>&1`""try {Start-Process -FilePath "cmd.exe" -ArgumentList $cmdArguments -Wait -WindowStyle Hidden} catch {1 unmodified line}}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 -Leafif (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 YellowInvoke-WebRequest -Uri $Uri -OutFile $OutFile}}}function Install-Aria2-Binary {Write-Log "--- Starting Aria2 binary installation ---" -Color Magenta$destFolder = "C:\Tools\aria2"if (-not (Test-Path $destFolder)) { New-Item -ItemType Directory -Force -Path $destFolder | Out-Null }$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-64bit-build1.zip"$zipPath = Join-Path $env:TEMP "aria2_temp.zip"Download-File -Uri $aria2Url -OutFile $zipPathWrite-Log "Extracting zip file to $destFolder..."Expand-Archive -Path $zipPath -DestinationPath $destFolder -Force$extractedSubfolder = Join-Path $destFolder "aria2-1.36.0-win-64bit-build1"if (Test-Path $extractedSubfolder) {Move-Item -Path (Join-Path $extractedSubfolder "*") -Destination $destFolder -ForceRemove-Item -Path $extractedSubfolder -Recurse -Force}$configFile = Join-Path $destFolder "aria2.conf"$configContent = "continue=true`nmax-connection-per-server=16`nsplit=16`nmin-split-size=1M`nfile-allocation=none"$configContent | Out-File $configFile -Encoding UTF8$envScope = "User"$oldPath = [System.Environment]::GetEnvironmentVariable("Path", $envScope)if ($oldPath -notlike "*$destFolder*") {7 unmodified lines}#===========================================================================# SECTION 2: MAIN SCRIPT EXECUTION#===========================================================================Clear-Host# --- Bannière ---Write-Log "-------------------------------------------------------------------------------"$asciiBanner = @'__ __ ___ _ ____ ______4 unmodified lines'@Write-Host $asciiBanner -ForegroundColor CyanWrite-Log "-------------------------------------------------------------------------------"Write-Log " ComfyUI - Git & Venv Based Installer " -Color YellowWrite-Log " Version 7.0 " -Color WhiteWrite-Log "-------------------------------------------------------------------------------"# --- Étape 1: Vérification et Installation de Python ---Write-Log "Step 1: Checking for Python 3.12..." -Color Yellow$pythonExe = Get-Command python -ErrorAction SilentlyContinue$pythonVersionOK = $falseif ($pythonExe) {# Capturer la sortie (va souvent sur le flux d'erreur)$versionString = (python --version 2>&1)Write-Log " - Found Python: $versionString"if ($versionString -like "Python 3.12*") {Write-Log " - Correct version already installed." -Color Green$pythonVersionOK = $true}}if (-not $pythonVersionOK) {Write-Log " - Python 3.12 not found. Downloading and installing..." -Color Yellow$pythonInstallerPath = Join-Path $env:TEMP "python-3.12-installer.exe"Download-File -Uri "https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe" -OutFile $pythonInstallerPathWrite-Log " - Running Python installer silently... (This may take a moment)"# Installation silencieuse, pour tous les utilisateurs, et ajout au PATHStart-Process -FilePath $pythonInstallerPath -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -WaitRemove-Item $pythonInstallerPathWrite-Log " - Python 3.12 installation complete." -Color Green}# --- Étape 2: Installation des dépendances (Aria2, 7-Zip, Git) ---Write-Log "`nStep 2: Checking for required tools..." -Color Yellowif (-not (Get-Command 'aria2c' -ErrorAction SilentlyContinue)) { Install-Aria2-Binary } else { Write-Log " - Aria2 is already installed." -Color Green }if (-not (Test-Path $sevenZipPath)) {$sevenZipInstaller = Join-Path $env:TEMP "7z-installer.exe"; Download-File -Uri "https://www.7-zip.org/a/7z2201-x64.exe" -OutFile $sevenZipInstaller; Start-Process -FilePath $sevenZipInstaller -ArgumentList "/S" -Wait; Remove-Item $sevenZipInstaller} else { Write-Log " - 7-Zip is already installed." -Color Green }if (-not (Get-Command git.exe -ErrorAction SilentlyContinue)) {$gitInstaller = Join-Path $env:TEMP "Git-Installer.exe"; Download-File -Uri "https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.3/Git-2.41.0.3-64-bit.exe" -OutFile $gitInstaller; Start-Process -FilePath $gitInstaller -ArgumentList "/VERYSILENT" -Wait; Remove-Item $gitInstaller}Invoke-AndLog "git" "config --system core.longpaths true"Write-Log " - Git is ready." -Color Green# --- Étape 3: Cloner ComfyUI et créer le Venv ---Write-Log "`nStep 3: Cloning ComfyUI and creating Virtual Environment..." -Color Yellowif (-not (Test-Path $comfyPath)) {Write-Log " - Cloning ComfyUI repository..."Invoke-AndLog "git" "clone https://github.com/comfyanonymous/ComfyUI.git `"$comfyPath`""} else {Write-Log " - ComfyUI directory already exists. Skipping clone." -Color Green}if (-not (Test-Path (Join-Path $comfyPath "venv"))) {Write-Log " - Creating Python virtual environment (venv)..."Push-Location $comfyPathInvoke-AndLog "python" "-m venv venv"Pop-LocationWrite-Log " - Venv created successfully." -Color Green} else {Write-Log " - Venv already exists. Skipping creation." -Color Green}# --- Étape 4: Installation des dépendances dans le Venv ---Write-Log "`nStep 4: Installing all Python dependencies into the venv..." -Color YellowInvoke-AndLog "$venvPython" "-m pip install --upgrade pip wheel"Invoke-AndLog "$venvPython" "-m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121"Invoke-AndLog "$venvPython" "-m pip install -r `"$comfyPath\requirements.txt`""# --- Étape 5: Installation des Custom Nodes ---Write-Log "`nStep 5: Installing custom nodes..." -Color Yellow$customNodesPath = Join-Path $comfyPath "custom_nodes" # Définit le chemin pour les noeuds# ... (La liste des noeuds est inchangée)$customNodes = @(@{Name="ComfyUI-Manager"; Repo="https://github.com/ltdrdata/ComfyUI-Manager.git"; HasRequirements=$false},@{Name="ComfyUI-Impact-Pack"; Repo="https://github.com/ltdrdata/ComfyUI-Impact-Pack"; HasRequirements=$true},20 unmodified lines@{Name="ComfyUI-RMBG"; Repo="https://github.com/1038lab/ComfyUI-RMBG"; HasRequirements=$true},@{Name="ComfyUI-Detail-Daemon"; Repo="https://github.com/Jonseed/ComfyUI-Detail-Daemon"; HasRequirements=$true},@{Name="ComfyUI-TeaCache"; Repo="https://github.com/welltop-cn/ComfyUI-TeaCache"; HasRequirements=$true},@{Name="ComfyUI-Crystools"; Repo="https://github.com/crystian/ComfyUI-Crystools"; HasRequirements=$true})foreach ($node in $customNodes) {$nodePath = if ($node.Subfolder) { Join-Path $customNodesPath $node.Subfolder } else { Join-Path $customNodesPath $node.Name }if (-not (Test-Path $nodePath)) {Write-Log " - Installing $($node.Name)..."$cloneTargetPath = if ($node.Subfolder) { (Split-Path $nodePath -Parent) } else { $nodePath }if ($node.Name -eq 'ComfyUI-Impact-Subpack') { $clonePath = Join-Path $cloneTargetPath "impact_subpack" } else { $clonePath = $cloneTargetPath }Invoke-AndLog "git" "clone $($node.Repo) `"$clonePath`""if ($node.HasRequirements) {$requirementsFile = if ($node.RequirementsFile) { $node.RequirementsFile } else { "requirements.txt" }$reqPath = Join-Path $nodePath $requirementsFileif (Test-Path $reqPath) { Invoke-AndLog "$venvPython" "-m pip install -r `"$reqPath`"" }}} else { Write-Log " - $($node.Name) (already exists, skipping)" -Color Green }}# --- Étape 6: Installation des modules Python supplémentaires ---Write-Log "`nStep 6: Installing supplementary Python modules..." -Color YellowInvoke-AndLog "$venvPython" "-m pip install -U xformers --index-url https://download.pytorch.org/whl/cu121"# ... (Ajoutez ici l'installation de Triton, SageAttention etc. si nécessaire, en utilisant $venvPython) ...# --- Étape 7: Téléchargement des Workflows et Settings ---Write-Log "`nStep 7: Downloading Workflows & Settings..." -Color Yellow$userDefaultPath = Join-Path $comfyPath "user\default"; New-Item -Path $userDefaultPath -ItemType Directory -Force | Out-Null$workflowPath = Join-Path $userDefaultPath "workflows"; New-Item -Path $workflowPath -ItemType Directory -Force | Out-Null$workflowCloneDest = Join-Path $workflowPath "UmeAiRT-Workflow"$settingsFilePath = Join-Path $userDefaultPath "comfy.settings.json"Download-File -Uri "https://huggingface.co/UmeAiRT/ComfyUI-Auto_installer/resolve/main/others/comfy.settings.json" -OutFile $settingsFilePathif (-not (Test-Path $workflowCloneDest)) { Invoke-AndLog "git" "clone https://github.com/UmeAiRT/ComfyUI-Workflows `"$workflowCloneDest`"" }# --- Étape 8: Création du lanceur final ---Write-Log "`nStep 8: Creating final launcher script..." -Color Yellow$launcherContent = @"@echo offecho Activating ComfyUI virtual environment...call `"%~dp0ComfyUI\venv\Scripts\activate.bat`"echo Starting ComfyUI...cd `"%~dp0ComfyUI`"python main.py --windows-standalone-buildpause"@$launcherContent | Set-Content -Path (Join-Path $InstallPath "run_ComfyUI.bat")Write-Log " - Created run_ComfyUI.bat. Use this file to start the application." -Color Green# --- Étape 9: Téléchargement optionnel des packs de modèles ---Write-Log "`nStep 9: Optional Model Pack Downloads..." -Color Yellow$modelPacks = @( @{Name="FLUX"; ScriptName="Download-FLUX-Models.ps1"} )$scriptsSubFolder = Join-Path $InstallPath "scripts"foreach ($pack in $modelPacks) {$scriptPath = Join-Path $scriptsSubFolder $pack.ScriptNameif (-not (Test-Path $scriptPath)) { Write-Log "Model downloader script not found: '$($pack.ScriptName)'. Skipping." -Color Red; continue }$validInput = $falsewhile (-not $validInput) {Write-Host "`n[33mWould you like to download $($pack.Name) models? (Y/N)[0m"$choice = Read-Hostif ($choice -eq 'Y' -or $choice -eq 'y') {Write-Log " - Launching downloader for $($pack.Name) models..." -Color Green& $scriptPath -InstallPath $InstallPath$validInput = $true} elseif ($choice -eq 'N' -or $choice -eq 'n') {Write-Log " - Skipping download for $($pack.Name) models." -Color Gray$validInput = $true} else { Write-Host " [31mInvalid choice. Please enter Y or N.[0m" }}}#===========================================================================# FINALIZATION#===========================================================================Write-Log "-------------------------------------------------------------------------------" -Color GreenWrite-Log "Installation of ComfyUI and all nodes is complete!" -Color GreenRead-Host "Press Enter to close this window."
scripts/ComfyUI/Install-ComfyUI.ps1+138-255