Add ComfyUI maintenance skill
This commit is contained in:
parent
0647eb7c30
commit
dc6474befa
104
00_System/Codex/skills/comfyui-maintenance/SKILL.md
Normal file
104
00_System/Codex/skills/comfyui-maintenance/SKILL.md
Normal file
@ -0,0 +1,104 @@
|
||||
---
|
||||
name: comfyui-maintenance
|
||||
description: "Install, audit, update, and maintain this repository's local ComfyUI portable setup, custom nodes, GPU/CPU startup, and AI video model inventory. Use when the user asks about ComfyUI installation, whether ComfyUI is installed or running, updating ComfyUI/custom nodes, installing Wan/Wan2.x/ComfyUI models, diagnosing CUDA/PyTorch/NVIDIA driver issues, or preserving local ComfyUI setup notes in git."
|
||||
---
|
||||
|
||||
# ComfyUI Maintenance
|
||||
|
||||
## Overview
|
||||
|
||||
This skill maintains the local ComfyUI installation used alongside this knowledge base. It records the canonical install path, model inventory, custom nodes, known GPU constraints, and repeatable commands so future maintenance does not depend on chat history.
|
||||
|
||||
## Hard Rules
|
||||
|
||||
- Never add model files, archives, caches, or anything under `D:\AI` to this git repository.
|
||||
- Treat `D:\AI\ComfyUI_windows_portable` as the canonical local install unless the user explicitly moves it.
|
||||
- Read `references/current-install.md` before changing ComfyUI, custom nodes, Python packages, or model inventory.
|
||||
- Run `scripts/audit_comfyui.ps1` before and after maintenance work; update `references/current-install.md` when the installed state changes.
|
||||
- For "latest" ComfyUI releases, model repos, custom nodes, driver guidance, or install commands, verify current upstream sources before acting.
|
||||
- Keep user tokens and credentials out of the repository. Use environment variables such as `HF_TOKEN` when required.
|
||||
- Prefer CPU-mode startup validation when the GPU stack is known broken; only use GPU validation after confirming the NVIDIA driver and PyTorch CUDA runtime are compatible.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Inspect the existing install.
|
||||
- Run:
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\00_System\Codex\skills\comfyui-maintenance\scripts\audit_comfyui.ps1
|
||||
```
|
||||
- Compare the output with `references/current-install.md`.
|
||||
|
||||
2. Install or update ComfyUI.
|
||||
- Verify the latest official ComfyUI portable release or installation instructions first.
|
||||
- Download archives to `D:\AI\Downloads`.
|
||||
- Extract portable builds under `D:\AI`, keeping model directories intact.
|
||||
- Validate with `D:\AI\ComfyUI_windows_portable\run_cpu.bat` before attempting GPU mode.
|
||||
|
||||
3. Diagnose GPU mode.
|
||||
- Check `nvidia-smi`, driver version, GPU memory, and the portable Python `torch.version.cuda`.
|
||||
- If PyTorch uses a CUDA runtime newer than the installed NVIDIA driver supports, recommend a driver update instead of reinstalling ComfyUI first.
|
||||
- Do not assume GPU mode is healthy just because CPU mode starts.
|
||||
|
||||
4. Maintain custom nodes.
|
||||
- Custom nodes live under `D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes`.
|
||||
- Pull or clone the needed node repository, then install requirements with:
|
||||
```powershell
|
||||
D:\AI\ComfyUI_windows_portable\python_embeded\python.exe -m pip install -r <node>\requirements.txt
|
||||
```
|
||||
- Restart ComfyUI and check the import log for missing dependencies.
|
||||
|
||||
5. Install or update models.
|
||||
- Confirm which workflow needs the model: text-to-video, image-to-video, TI2V, S2V, Animate, Fun-Control, Fun-Inpaint, Fun-Camera, VACE, or GGUF low-VRAM mode.
|
||||
- Use the existing inventory in `references/current-install.md` to avoid duplicate downloads.
|
||||
- Place files in the matching ComfyUI model directory:
|
||||
- diffusion models: `ComfyUI\models\diffusion_models`
|
||||
- text encoders: `ComfyUI\models\text_encoders`
|
||||
- VAE: `ComfyUI\models\vae`
|
||||
- CLIP vision: `ComfyUI\models\clip_vision`
|
||||
- VAE approximations: `ComfyUI\models\vae_approx`
|
||||
- LoRAs: `ComfyUI\models\loras`
|
||||
|
||||
6. Validate and record.
|
||||
- Start ComfyUI in CPU mode.
|
||||
- Open or request `http://127.0.0.1:8188/`.
|
||||
- Check startup logs for failed imports or missing model dependencies.
|
||||
- Re-run the audit script and update `references/current-install.md`.
|
||||
- Commit only the skill/reference/script changes, never generated assets or installed model binaries.
|
||||
|
||||
## Commands
|
||||
|
||||
Audit current state:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\00_System\Codex\skills\comfyui-maintenance\scripts\audit_comfyui.ps1
|
||||
```
|
||||
|
||||
Audit as JSON:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\00_System\Codex\skills\comfyui-maintenance\scripts\audit_comfyui.ps1 -Json
|
||||
```
|
||||
|
||||
Start CPU mode:
|
||||
|
||||
```powershell
|
||||
D:\AI\ComfyUI_windows_portable\run_cpu.bat
|
||||
```
|
||||
|
||||
Start GPU mode, only after driver/CUDA compatibility is confirmed:
|
||||
|
||||
```powershell
|
||||
D:\AI\ComfyUI_windows_portable\run_nvidia_gpu.bat
|
||||
```
|
||||
|
||||
Download one Hugging Face file into a ComfyUI model directory:
|
||||
|
||||
```powershell
|
||||
D:\AI\ComfyUI_windows_portable\python_embeded\python.exe .\00_System\Codex\skills\comfyui-maintenance\scripts\download_hf_model.py --repo Comfy-Org/Wan_2.2_ComfyUI_Repackaged --file split_files/vae/wan2.2_vae.safetensors --dest D:\AI\ComfyUI_windows_portable\ComfyUI\models\vae
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- `references/current-install.md` - current local install, custom nodes, model inventory, and known issues.
|
||||
- `scripts/audit_comfyui.ps1` - repeatable local audit.
|
||||
- `scripts/download_hf_model.py` - single-file Hugging Face download helper for ComfyUI model folders.
|
||||
@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "ComfyUI Maintenance"
|
||||
short_description: "Install, audit, and maintain this repo's local ComfyUI setup."
|
||||
default_prompt: "Use $comfyui-maintenance to audit or update the local ComfyUI installation and model inventory."
|
||||
@ -0,0 +1,114 @@
|
||||
# Current ComfyUI Install
|
||||
|
||||
Last audited: 2026-06-29
|
||||
|
||||
## Canonical Paths
|
||||
|
||||
- Portable root: `D:\AI\ComfyUI_windows_portable`
|
||||
- ComfyUI root: `D:\AI\ComfyUI_windows_portable\ComfyUI`
|
||||
- Downloads: `D:\AI\Downloads`
|
||||
- CPU launcher: `D:\AI\ComfyUI_windows_portable\run_cpu.bat`
|
||||
- GPU launcher: `D:\AI\ComfyUI_windows_portable\run_nvidia_gpu.bat`
|
||||
- Local URL: `http://127.0.0.1:8188/`
|
||||
|
||||
## Installed State
|
||||
|
||||
- ComfyUI version: `v0.26.0`
|
||||
- ComfyUI commit: `f6c162d`
|
||||
- Portable archive: `D:\AI\Downloads\ComfyUI_windows_portable_nvidia_v0.26.0.7z`
|
||||
- Archive SHA256: `93467D18D960BF1323A24F9998E6C6D328386B2AAFDECD6EF95BE4EEE01645CD`
|
||||
- Portable Python: `3.13.12`
|
||||
- Portable PyTorch: `2.12.0+cu130`
|
||||
- Validation: CPU mode starts and `http://127.0.0.1:8188/` returns ComfyUI.
|
||||
|
||||
## Hardware And GPU Status
|
||||
|
||||
- GPU: NVIDIA GeForce RTX 2060, 6 GB VRAM
|
||||
- NVIDIA driver: `546.59`
|
||||
- `nvidia-smi` reports CUDA support up to `12.3`
|
||||
- Current portable PyTorch uses CUDA `13.0`
|
||||
- Result: GPU mode is blocked until the NVIDIA driver is updated to a version compatible with the CUDA runtime used by the installed PyTorch build. CPU mode is usable.
|
||||
|
||||
Known GPU failure signature:
|
||||
|
||||
```text
|
||||
cudaGetDeviceCount cudaErrorNotSupported
|
||||
Fatal Python error: access violation
|
||||
```
|
||||
|
||||
## Custom Nodes
|
||||
|
||||
Installed under `D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes`.
|
||||
|
||||
| Node | Commit | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `ComfyUI-Manager` | `8da299d` | Node/package management |
|
||||
| `ComfyUI-GGUF` | `6ea2651` | GGUF low-VRAM model loading |
|
||||
| `ComfyUI-WanVideoWrapper` | `088128b` | Wan video workflows and wrappers |
|
||||
| `ComfyUI-KJNodes` | `bc8e4ce` | Utility/video workflow nodes |
|
||||
| `ComfyUI-VideoHelperSuite` | `4ee72c0` | Video loading/saving helpers |
|
||||
|
||||
Dependency notes:
|
||||
|
||||
- Installed requirements for the listed custom nodes into portable Python.
|
||||
- Optional packages installed include `onnx`, `onnxruntime`, `sageattention`, and `triton-windows`.
|
||||
- Remaining startup warnings are GPU/CUDA related or ComfyUI API deprecation warnings; they were non-blocking during CPU validation.
|
||||
|
||||
## Model Inventory
|
||||
|
||||
Approximate model directory totals from the last audit:
|
||||
|
||||
| Directory | Files | Size |
|
||||
| --- | ---: | ---: |
|
||||
| `diffusion_models` | 25 | 319.11 GB |
|
||||
| `text_encoders` | 2 | 6.27 GB |
|
||||
| `vae` | 3 | 1.55 GB |
|
||||
| `clip_vision` | 2 | 1.18 GB |
|
||||
| `vae_approx` | 11 | 0.06 GB |
|
||||
|
||||
### Diffusion Models
|
||||
|
||||
Located in `D:\AI\ComfyUI_windows_portable\ComfyUI\models\diffusion_models`.
|
||||
|
||||
| File | Approx Size | Notes |
|
||||
| --- | ---: | --- |
|
||||
| `wan2.2_ti2v_5B_fp16.safetensors` | 9.313 GB | Official TI2V 5B |
|
||||
| `wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors` | 13.312 GB | Official T2V high-noise FP8 |
|
||||
| `wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors` | 13.312 GB | Official T2V low-noise FP8 |
|
||||
| `wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors` | 13.313 GB | Official I2V high-noise FP8 |
|
||||
| `wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors` | 13.313 GB | Official I2V low-noise FP8 |
|
||||
| `Wan2_2-T2V-A14B-HIGH-HoloCine-full_fp8_e4m3fn_scaled_KJ.safetensors` | 13.971 GB | Anime/cinematic T2V high |
|
||||
| `Wan2_2-T2V-A14B-LOW-HoloCine-full_fp8_e4m3fn_scaled_KJ.safetensors` | 13.971 GB | Anime/cinematic T2V low |
|
||||
| `Wan2_2-I2V_AniSoraV3_2_HIGH_14B_fp8_e4m3fn_scaled_KJ.safetensors` | 13.973 GB | Anime I2V high |
|
||||
| `Wan2_2-I2V_AniSoraV3_2_LOW_14B_fp8_e4m3fn_scaled_KJ.safetensors` | 13.973 GB | Anime I2V low |
|
||||
| `wan2.2_s2v_14B_fp8_scaled.safetensors` | 15.269 GB | S2V |
|
||||
| `wan2.2_animate_14B_bf16.safetensors` | 32.177 GB | Animate |
|
||||
| `wan2.2_fun_control_high_noise_14B_fp8_scaled.safetensors` | 13.314 GB | Fun-Control high |
|
||||
| `wan2.2_fun_control_low_noise_14B_fp8_scaled.safetensors` | 13.314 GB | Fun-Control low |
|
||||
| `wan2.2_fun_inpaint_high_noise_14B_fp8_scaled.safetensors` | 13.313 GB | Fun-Inpaint high |
|
||||
| `wan2.2_fun_inpaint_low_noise_14B_fp8_scaled.safetensors` | 13.313 GB | Fun-Inpaint low |
|
||||
| `wan2.2_fun_camera_high_noise_14B_fp8_scaled.safetensors` | 14.251 GB | Fun-Camera high |
|
||||
| `wan2.2_fun_camera_low_noise_14B_fp8_scaled.safetensors` | 14.251 GB | Fun-Camera low |
|
||||
| `wan2.2_fun_vace_high_noise_14B_fp8_scaled.safetensors` | 16.155 GB | Fun-VACE high |
|
||||
| `wan2.2_fun_vace_low_noise_14B_fp8_scaled.safetensors` | 16.155 GB | Fun-VACE low |
|
||||
| `Wan2.2-TI2V-5B-Q4_K_M.gguf` | 3.197 GB | Low-VRAM GGUF |
|
||||
| `Wan2.2-T2V-A14B-HighNoise-Q4_K_M.gguf` | 8.987 GB | Low-VRAM GGUF |
|
||||
| `Wan2.2-T2V-A14B-LowNoise-Q4_K_M.gguf` | 8.987 GB | Low-VRAM GGUF |
|
||||
| `Wan2.2-I2V-A14B-HighNoise-Q4_K_M.gguf` | 8.989 GB | Low-VRAM GGUF |
|
||||
| `Wan2.2-I2V-A14B-LowNoise-Q4_K_M.gguf` | 8.989 GB | Low-VRAM GGUF |
|
||||
|
||||
### Shared Models
|
||||
|
||||
- `models\text_encoders\umt5_xxl_fp8_e4m3fn_scaled.safetensors` - 6.273 GB
|
||||
- `models\vae\wan2.2_vae.safetensors` - 1.313 GB
|
||||
- `models\vae\wan_2.1_vae.safetensors` - 0.236 GB
|
||||
- `models\clip_vision\open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors` - 1.177 GB
|
||||
- `models\vae_approx\taew2_1.safetensors` - 0.021 GB
|
||||
- `models\vae_approx\taew2_2.safetensors` - 0.021 GB
|
||||
|
||||
## Maintenance Notes
|
||||
|
||||
- Use `HF_HUB_DISABLE_XET=1` when Hugging Face Xet/CAS downloads stall or return authorization errors.
|
||||
- Prefer FP8 or GGUF variants for the RTX 2060 6 GB environment; avoid duplicate BF16/FP16 downloads unless a workflow specifically needs them.
|
||||
- After installing or updating models, remove stale `.incomplete` or `.lock` files only when no download process is running.
|
||||
- Update this file whenever ComfyUI version, custom node commits, Python packages, GPU status, or model inventory changes.
|
||||
@ -0,0 +1,239 @@
|
||||
param(
|
||||
[string]$Root = "D:\AI\ComfyUI_windows_portable",
|
||||
[int]$Port = 8188,
|
||||
[switch]$Json
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
|
||||
function Get-GitState {
|
||||
param([string]$Path)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
return $null
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $Path ".git"))) {
|
||||
return [ordered]@{
|
||||
branch = $null
|
||||
commit = $null
|
||||
dirty = $null
|
||||
}
|
||||
}
|
||||
|
||||
$oldLocation = Get-Location
|
||||
try {
|
||||
Set-Location -LiteralPath $Path
|
||||
$branch = ((git rev-parse --abbrev-ref HEAD 2>$null) -join "").Trim()
|
||||
$commit = ((git rev-parse --short HEAD 2>$null) -join "").Trim()
|
||||
$dirtyOutput = git status --porcelain 2>$null
|
||||
return [ordered]@{
|
||||
branch = $branch
|
||||
commit = $commit
|
||||
dirty = [bool]$dirtyOutput
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Set-Location $oldLocation
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DirectoryStats {
|
||||
param([string]$Path)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
return [ordered]@{
|
||||
exists = $false
|
||||
files = 0
|
||||
size_gb = 0
|
||||
}
|
||||
}
|
||||
|
||||
$files = @(Get-ChildItem -LiteralPath $Path -File -Recurse -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -notmatch '\\\.cache\\' })
|
||||
$sum = ($files | Measure-Object -Property Length -Sum).Sum
|
||||
if (-not $sum) {
|
||||
$sum = 0
|
||||
}
|
||||
|
||||
return [ordered]@{
|
||||
exists = $true
|
||||
files = $files.Count
|
||||
size_gb = [math]::Round($sum / 1GB, 3)
|
||||
}
|
||||
}
|
||||
|
||||
function Read-TorchInfo {
|
||||
param(
|
||||
[string]$Root
|
||||
)
|
||||
|
||||
$version = $null
|
||||
$cudaRuntime = $null
|
||||
$torchVersionPy = Join-Path $Root "python_embeded\Lib\site-packages\torch\version.py"
|
||||
if (Test-Path -LiteralPath $torchVersionPy) {
|
||||
$versionLine = Select-String -LiteralPath $torchVersionPy -Pattern "^__version__" | Select-Object -First 1
|
||||
if ($versionLine -and $versionLine.Line -match "['""]([^'""]+)['""]") {
|
||||
$version = $Matches[1]
|
||||
}
|
||||
$cudaLine = Select-String -LiteralPath $torchVersionPy -Pattern "^cuda:" | Select-Object -First 1
|
||||
if ($cudaLine -and $cudaLine.Line -match "['""]([^'""]+)['""]") {
|
||||
$cudaRuntime = $Matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
return [ordered]@{
|
||||
torch = $version
|
||||
cuda_runtime = $cudaRuntime
|
||||
cuda_check = "not_checked_to_avoid_driver_runtime_crashes"
|
||||
}
|
||||
}
|
||||
|
||||
$comfyRoot = Join-Path $Root "ComfyUI"
|
||||
$python = Join-Path $Root "python_embeded\python.exe"
|
||||
$modelsRoot = Join-Path $comfyRoot "models"
|
||||
$customNodesRoot = Join-Path $comfyRoot "custom_nodes"
|
||||
$versionPath = Join-Path $comfyRoot "comfyui_version.py"
|
||||
|
||||
$version = $null
|
||||
if (Test-Path -LiteralPath $versionPath) {
|
||||
$versionLine = Select-String -LiteralPath $versionPath -Pattern "__version__" | Select-Object -First 1
|
||||
if ($versionLine -and $versionLine.Line -match '["'']([^"'']+)["'']') {
|
||||
$version = $Matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
$nvidia = $null
|
||||
if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) {
|
||||
$nvidia = ((nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader 2>$null) -join "`n").Trim()
|
||||
}
|
||||
|
||||
$portState = $null
|
||||
if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) {
|
||||
$portState = @(Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction SilentlyContinue).Count -gt 0
|
||||
}
|
||||
|
||||
$httpStatus = $null
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://127.0.0.1:$Port/" -UseBasicParsing -TimeoutSec 2
|
||||
$httpStatus = [int]$response.StatusCode
|
||||
}
|
||||
catch {
|
||||
$httpStatus = $null
|
||||
}
|
||||
|
||||
$processes = @(Get-CimInstance Win32_Process -Filter "name = 'python.exe' OR name = 'python3.exe'" |
|
||||
Where-Object { $_.CommandLine -like "*ComfyUI*" -and $_.CommandLine -like "*main.py*" } |
|
||||
Select-Object ProcessId, CommandLine)
|
||||
|
||||
$modelDirs = @(
|
||||
"checkpoints",
|
||||
"clip_vision",
|
||||
"diffusion_models",
|
||||
"loras",
|
||||
"text_encoders",
|
||||
"vae",
|
||||
"vae_approx"
|
||||
)
|
||||
|
||||
$modelStats = [ordered]@{}
|
||||
foreach ($dir in $modelDirs) {
|
||||
$modelStats[$dir] = Get-DirectoryStats -Path (Join-Path $modelsRoot $dir)
|
||||
}
|
||||
|
||||
$wanModels = @()
|
||||
$diffusionPath = Join-Path $modelsRoot "diffusion_models"
|
||||
if (Test-Path -LiteralPath $diffusionPath) {
|
||||
$wanModels = @(Get-ChildItem -LiteralPath $diffusionPath -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -match "wan|Wan" } |
|
||||
Sort-Object Name |
|
||||
ForEach-Object {
|
||||
[ordered]@{
|
||||
name = $_.Name
|
||||
size_gb = [math]::Round($_.Length / 1GB, 3)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$knownNodes = @(
|
||||
"ComfyUI-Manager",
|
||||
"ComfyUI-GGUF",
|
||||
"ComfyUI-WanVideoWrapper",
|
||||
"ComfyUI-KJNodes",
|
||||
"ComfyUI-VideoHelperSuite"
|
||||
)
|
||||
|
||||
$customNodes = @()
|
||||
foreach ($node in $knownNodes) {
|
||||
$nodePath = Join-Path $customNodesRoot $node
|
||||
$customNodes += [ordered]@{
|
||||
name = $node
|
||||
exists = Test-Path -LiteralPath $nodePath
|
||||
path = $nodePath
|
||||
git = Get-GitState -Path $nodePath
|
||||
}
|
||||
}
|
||||
|
||||
$result = [ordered]@{
|
||||
root = $Root
|
||||
comfy_root = $comfyRoot
|
||||
exists = Test-Path -LiteralPath $comfyRoot
|
||||
version = $version
|
||||
git = Get-GitState -Path $comfyRoot
|
||||
python = $python
|
||||
torch = Read-TorchInfo -Root $Root
|
||||
nvidia = $nvidia
|
||||
port = [ordered]@{
|
||||
number = $Port
|
||||
listening = $portState
|
||||
http_status = $httpStatus
|
||||
}
|
||||
processes = $processes
|
||||
custom_nodes = $customNodes
|
||||
model_stats = $modelStats
|
||||
wan_diffusion_models = $wanModels
|
||||
}
|
||||
|
||||
if ($Json) {
|
||||
$result | ConvertTo-Json -Depth 8
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "ComfyUI audit"
|
||||
Write-Host "Root: $($result.root)"
|
||||
Write-Host "Exists: $($result.exists)"
|
||||
Write-Host "Version: $($result.version)"
|
||||
if ($result.git) {
|
||||
Write-Host "Git: $($result.git.branch) $($result.git.commit) dirty=$($result.git.dirty)"
|
||||
}
|
||||
Write-Host "Python: $($result.python)"
|
||||
if ($result.torch) {
|
||||
Write-Host "Torch: $($result.torch.torch) cuda_runtime=$($result.torch.cuda_runtime) cuda_check=$($result.torch.cuda_check)"
|
||||
}
|
||||
Write-Host "NVIDIA: $($result.nvidia)"
|
||||
Write-Host "Port ${Port}: listening=$($result.port.listening) http_status=$($result.port.http_status)"
|
||||
Write-Host "ComfyUI processes: $($result.processes.Count)"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Custom nodes"
|
||||
foreach ($node in $result.custom_nodes) {
|
||||
$commit = $null
|
||||
$dirty = $null
|
||||
if ($node.git) {
|
||||
$commit = $node.git.commit
|
||||
$dirty = $node.git.dirty
|
||||
}
|
||||
Write-Host ("- {0}: exists={1} commit={2} dirty={3}" -f $node.name, $node.exists, $commit, $dirty)
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Model directories"
|
||||
foreach ($dir in $modelDirs) {
|
||||
$stats = $result.model_stats[$dir]
|
||||
Write-Host ("- {0}: exists={1} files={2} size_gb={3}" -f $dir, $stats.exists, $stats.files, $stats.size_gb)
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Wan diffusion models: $($result.wan_diffusion_models.Count)"
|
||||
foreach ($model in $result.wan_diffusion_models) {
|
||||
Write-Host ("- {0} ({1} GB)" -f $model.name, $model.size_gb)
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Download one Hugging Face file into a ComfyUI model directory."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--repo", required=True, help="Hugging Face repo id, for example Comfy-Org/Wan_2.2_ComfyUI_Repackaged.")
|
||||
parser.add_argument("--file", required=True, help="Repo file path, for example split_files/vae/wan2.2_vae.safetensors.")
|
||||
parser.add_argument("--dest", required=True, help="Destination ComfyUI model directory.")
|
||||
parser.add_argument("--revision", default=None, help="Optional repo revision, branch, tag, or commit.")
|
||||
parser.add_argument("--cache-dir", default=None, help="Optional Hugging Face cache directory.")
|
||||
parser.add_argument("--token", default=os.environ.get("HF_TOKEN"), help="Hugging Face token. Defaults to HF_TOKEN.")
|
||||
parser.add_argument("--keep-tree", action="store_true", help="Keep repo subdirectories under --dest instead of flattening to the file name.")
|
||||
parser.add_argument("--force", action="store_true", help="Replace an existing target file.")
|
||||
parser.add_argument("--use-xet", action="store_true", help="Allow Hugging Face Xet/CAS downloads. Disabled by default for reliability.")
|
||||
parser.add_argument("--retries", type=int, default=3, help="Download attempts before failing.")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def remove_empty_parents(path: Path, stop: Path) -> None:
|
||||
parent = path.parent
|
||||
stop = stop.resolve()
|
||||
while parent.exists() and parent.resolve() != stop:
|
||||
try:
|
||||
parent.rmdir()
|
||||
except OSError:
|
||||
break
|
||||
parent = parent.parent
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
|
||||
if not args.use_xet:
|
||||
os.environ.setdefault("HF_HUB_DISABLE_XET", "1")
|
||||
|
||||
try:
|
||||
from huggingface_hub import hf_hub_download
|
||||
except ImportError:
|
||||
print("Missing dependency: huggingface_hub. Install with: python -m pip install huggingface_hub", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
dest = Path(args.dest)
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
target = dest / args.file if args.keep_tree else dest / Path(args.file).name
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if target.exists() and not args.force:
|
||||
print(f"Already exists: {target}")
|
||||
return 0
|
||||
|
||||
last_error: Exception | None = None
|
||||
downloaded: Path | None = None
|
||||
for attempt in range(1, args.retries + 1):
|
||||
try:
|
||||
downloaded = Path(
|
||||
hf_hub_download(
|
||||
repo_id=args.repo,
|
||||
filename=args.file,
|
||||
revision=args.revision,
|
||||
token=args.token,
|
||||
cache_dir=args.cache_dir,
|
||||
local_dir=str(dest),
|
||||
)
|
||||
)
|
||||
break
|
||||
except Exception as exc: # noqa: BLE001 - report upstream download errors plainly.
|
||||
last_error = exc
|
||||
if attempt == args.retries:
|
||||
break
|
||||
wait_seconds = min(30, attempt * 5)
|
||||
print(f"Download failed on attempt {attempt}/{args.retries}: {exc}", file=sys.stderr)
|
||||
print(f"Retrying in {wait_seconds}s...", file=sys.stderr)
|
||||
time.sleep(wait_seconds)
|
||||
|
||||
if downloaded is None:
|
||||
print(f"Download failed: {last_error}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if downloaded.resolve() != target.resolve():
|
||||
temp_target = target.with_name(target.name + ".tmp")
|
||||
if temp_target.exists():
|
||||
temp_target.unlink()
|
||||
shutil.move(str(downloaded), str(temp_target))
|
||||
temp_target.replace(target)
|
||||
remove_empty_parents(downloaded, dest)
|
||||
|
||||
print(f"Downloaded: {target}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@ -102,6 +102,9 @@ These skills are project-local. They are not copied into `C:\Users\daixiawu\.cod
|
||||
- **imagegen** (`00_System/Codex/skills/imagegen/SKILL.md`) — 生成或编辑位图图像资产;包含提示词规范、透明背景后处理、OpenAI 图像 API/CLI 兜底脚本和参考文档。
|
||||
- Trigger: `/imagegen`、`$imagegen`、生成图片、编辑图片、透明背景、图像资产、img2、生图
|
||||
|
||||
- **comfyui-maintenance** (`00_System/Codex/skills/comfyui-maintenance/SKILL.md`) — ComfyUI 本地安装、更新、审计、Wan/Wan2.x 模型库存、自定义节点、GPU/CPU 启动与 CUDA/PyTorch/驱动诊断。
|
||||
- Trigger: `/comfyui-maintenance`、ComfyUI 安装/更新/维护、Wan/Wan2.x 模型安装、ComfyUI GPU/CUDA 报错
|
||||
|
||||
- **pre-check-existing-resources** (`00_System/Codex/skills/pre-check-existing-resources/SKILL.md`) — 创建或修改资源前检查是否已有现成资源,避免重复创建。
|
||||
- Trigger: 创建新项目、修改现有代码、添加功能模块前
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user