Add cupy check to Load nodes with install instructions
BIM-VFI, SGM-VFI, and GIMM-VFI Load nodes now check for cupy at load time and raise a clear error with the user's CUDA version and the exact pip install command. Updated README with step-by-step cupy install instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
25
nodes.py
25
nodes.py
@@ -18,6 +18,28 @@ from .gimm_vfi_arch import clear_gimm_caches
|
||||
logger = logging.getLogger("Tween")
|
||||
|
||||
|
||||
def _check_cupy(model_name):
|
||||
"""Raise a clear error if cupy is not installed."""
|
||||
try:
|
||||
import cupy # noqa: F401
|
||||
except ImportError:
|
||||
try:
|
||||
cuda_ver = torch.version.cuda or "unknown"
|
||||
major = int(cuda_ver.split(".")[0])
|
||||
cupy_pkg = f"cupy-cuda{major}x"
|
||||
except Exception:
|
||||
cuda_ver = "unknown"
|
||||
cupy_pkg = "cupy-cuda12x # adjust to your CUDA version"
|
||||
raise RuntimeError(
|
||||
f"{model_name} requires cupy but it is not installed.\n\n"
|
||||
f"Your PyTorch CUDA version: {cuda_ver}\n\n"
|
||||
f"Install it with:\n"
|
||||
f" pip install {cupy_pkg}\n\n"
|
||||
f"If you are unsure of your CUDA version, run:\n"
|
||||
f" python -c \"import torch; print(torch.version.cuda)\""
|
||||
)
|
||||
|
||||
|
||||
def _compute_target_fps_params(source_fps, target_fps):
|
||||
"""Compute oversampling parameters for target FPS mode.
|
||||
|
||||
@@ -138,6 +160,7 @@ class LoadBIMVFIModel:
|
||||
CATEGORY = "video/BIM-VFI"
|
||||
|
||||
def load_model(self, model_path, auto_pyr_level, pyr_level):
|
||||
_check_cupy("BIM-VFI")
|
||||
full_path = os.path.join(MODEL_DIR, model_path)
|
||||
|
||||
if not os.path.exists(full_path):
|
||||
@@ -1110,6 +1133,7 @@ class LoadSGMVFIModel:
|
||||
CATEGORY = "video/SGM-VFI"
|
||||
|
||||
def load_model(self, model_path, tta, num_key_points):
|
||||
_check_cupy("SGM-VFI")
|
||||
full_path = os.path.join(SGM_MODEL_DIR, model_path)
|
||||
|
||||
if not os.path.exists(full_path):
|
||||
@@ -1522,6 +1546,7 @@ class LoadGIMMVFIModel:
|
||||
CATEGORY = "video/GIMM-VFI"
|
||||
|
||||
def load_model(self, model_path, ds_factor):
|
||||
_check_cupy("GIMM-VFI")
|
||||
full_path = os.path.join(GIMM_MODEL_DIR, model_path)
|
||||
|
||||
# Auto-download main model if missing
|
||||
|
||||
Reference in New Issue
Block a user