Remove auto-install of all deps except cupy

Dependencies are now handled by pyproject.toml / requirements.txt
via ComfyUI Manager or pip. Only cupy is auto-installed at load time
since it requires matching the PyTorch CUDA version; failures produce
a warning instead of crashing. Also added timm to requirements.txt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 13:13:01 +01:00
parent 8311fd0261
commit 8fe382e5ec
3 changed files with 32 additions and 44 deletions

View File

@@ -5,45 +5,35 @@ import logging
logger = logging.getLogger("Tween")
def _auto_install_deps():
"""Auto-install missing dependencies on first load."""
# gdown
try:
import gdown # noqa: F401
except ImportError:
logger.info("[Tween] Installing gdown...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "gdown"])
# timm (required for EMA-VFI's MotionFormer backbone)
try:
import timm # noqa: F401
except ImportError:
logger.info("[Tween] Installing timm...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "timm"])
# cupy
def _ensure_cupy():
"""Try to auto-install cupy if missing, matching the PyTorch CUDA version."""
try:
import cupy # noqa: F401
return
except ImportError:
try:
import torch
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}")
pass
# GIMM-VFI dependencies
for pkg in ("omegaconf", "yacs", "easydict", "einops", "huggingface_hub"):
try:
__import__(pkg)
except ImportError:
logger.info(f"[Tween] Installing {pkg}...")
subprocess.check_call([sys.executable, "-m", "pip", "install", pkg])
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"
)
_auto_install_deps()
_ensure_cupy()
from .nodes import (
LoadBIMVFIModel, BIMVFIInterpolate, BIMVFISegmentInterpolate, TweenConcatVideos,