Remove cupy auto-install from __init__.py
No more pip calls at import time. Users get a clear error with install instructions from the Load node if cupy is missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
37
__init__.py
37
__init__.py
@@ -1,40 +1,3 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger("Tween")
|
||||
|
||||
|
||||
def _ensure_cupy():
|
||||
"""Try to auto-install cupy if missing, matching the PyTorch CUDA version."""
|
||||
try:
|
||||
import cupy # noqa: F401
|
||||
return
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import torch
|
||||
if not torch.cuda.is_available() or not hasattr(torch.version, "cuda") or torch.version.cuda is None:
|
||||
logger.warning(
|
||||
"[Tween] CUDA not available — cupy cannot be installed. "
|
||||
"SGM-VFI and GIMM-VFI require CUDA."
|
||||
)
|
||||
return
|
||||
major = int(torch.version.cuda.split(".")[0])
|
||||
cupy_pkg = f"cupy-cuda{major}x"
|
||||
logger.info(f"[Tween] Installing {cupy_pkg} (CUDA {torch.version.cuda})...")
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", cupy_pkg])
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"[Tween] Could not auto-install cupy: {e}\n"
|
||||
f"[Tween] SGM-VFI and GIMM-VFI will not work without cupy. Install manually:\n"
|
||||
f"[Tween] pip install cupy-cuda12x # replace 12 with your CUDA major version"
|
||||
)
|
||||
|
||||
|
||||
_ensure_cupy()
|
||||
|
||||
from .nodes import (
|
||||
LoadBIMVFIModel, BIMVFIInterpolate, BIMVFISegmentInterpolate, TweenConcatVideos,
|
||||
LoadEMAVFIModel, EMAVFIInterpolate, EMAVFISegmentInterpolate,
|
||||
|
||||
Reference in New Issue
Block a user