Files
iGavroche 740b347e92 v2.3.22: Sampler attention_backend selector, dead inputs + VAE dtype machinery removed
- ROCmSamplerCustomAdvanced: new attention_backend input (auto/pytorch/
  comfy_kitchen_int8/flash), installed on a clone of guider.model_options
  so the shared ModelPatcher stays clean and sparse-attention overrides
  still chain on top
- Removed dead inputs: precision_mode, batch_optimization, flash_attention,
  test_steps; fix_empty_latent_channels now passes downscale ratios like
  stock; disable_pbar actually forwarded
- ROCmVAEDecode: deleted unreachable VAE re-dtype machinery (first_stage_model
  .dtype is None for every shipped VAE); decode follows vae.vae_dtype and
  never mutates shared weights; fp16 accumulation now goes through
  apply_rocm_backend_settings (rdna3_5 pre-7.14 guard respected), same fix
  in ROCmGGUFLoader which also stopped forcing allow_tf32=False
- Deleted ROCmSamplerCustomAdvancedBenchmark node (ROCmFluxBenchmark remains)
- batch_cap field + *_BATCH_CAP constants, select_precision, dead tail of
  apply_rocm_backend_settings removed
- conftest stubs extended (comfy.audio, model_patcher, ldm attention,
  folder_paths, interrupt hook): 184 passed, 24 skipped, 0 failed
- Docs: node docs, README, Benchmarks, ARCHITECTURE refreshed to current
  stack (ROCm 7.16 / torch 2.15.0a0+rocm10.1.0)
2026-10-14 10:16:55 -04:00

77 lines
2.3 KiB
Python

#!/usr/bin/env python
"""
Update ComfyUI workflow JSONs to current ROCm Ninodes naming conventions.
Usage:
uv run python scripts/update_workflows.py --paths "C:\\Users\\Nino\\ComfyUI\\user\\default\\workflows" "comfyui_workflows"
Behavior:
- Scans .json files recursively in given paths
- Applies conservative string replacements based on known mappings
- Writes .bak alongside modified files
"""
import argparse
import json
import sys
from pathlib import Path
MAPPINGS = {
# Class renames: old → new canonical names
"ROCMOptimizedCheckpointLoader": "ROCmCheckpointLoader",
"ROCMOptimizedUNetLoader": "ROCmDiffusionLoader",
"ROCMOptimizedVAEDecode": "ROCmVAEDecode",
"ROCMOptimizedVAEDecodeTiled": "ROCmVAEDecodeTiled",
"ROCMVAEPerformanceMonitor": "ROCmVAEPerformanceMonitor",
"ROCMOptimizedKSampler": "ROCmKSampler",
"ROCMOptimizedKSamplerAdvanced": "ROCmKSamplerAdvanced",
"ROCMSamplerCustomAdvanced": "ROCmSamplerCustomAdvanced",
"ROCMSamplerPerformanceMonitor": "ROCmSamplerPerformanceMonitor",
"ROCMFluxBenchmark": "ROCmFluxBenchmark",
"ROCMMemoryOptimizer": "ROCmMemoryOptimizer",
"ROCMLoRALoader": "ROCmLoRALoader",
}
def migrate_file(path: Path) -> bool:
try:
original = path.read_text(encoding="utf-8")
except Exception:
return False
updated = original
for old, new in MAPPINGS.items():
updated = updated.replace(old, new)
if updated != original:
backup = path.with_suffix(path.suffix + ".bak")
backup.write_text(original, encoding="utf-8")
path.write_text(updated, encoding="utf-8")
return True
return False
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--paths", nargs="+", required=True, help="Directories to scan recursively for .json workflows")
args = parser.parse_args()
changed = 0
checked = 0
for raw in args.paths:
root = Path(raw)
if not root.exists():
continue
for p in root.rglob("*.json"):
checked += 1
if migrate_file(p):
changed += 1
print(f"Checked {checked} workflow(s); updated {changed}.")
return 0
if __name__ == "__main__":
raise SystemExit(main())