The concat node is model-agnostic (just joins video segments via ffmpeg), so it shouldn't be under BIM-VFI. Now accepts any model type as the dependency input and lives under the video/Tween category. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
2.4 KiB
Python
71 lines
2.4 KiB
Python
import subprocess
|
|
import sys
|
|
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
|
|
try:
|
|
import cupy # noqa: F401
|
|
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}")
|
|
|
|
|
|
_auto_install_deps()
|
|
|
|
from .nodes import (
|
|
LoadBIMVFIModel, BIMVFIInterpolate, BIMVFISegmentInterpolate, TweenConcatVideos,
|
|
LoadEMAVFIModel, EMAVFIInterpolate, EMAVFISegmentInterpolate,
|
|
LoadSGMVFIModel, SGMVFIInterpolate, SGMVFISegmentInterpolate,
|
|
)
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"LoadBIMVFIModel": LoadBIMVFIModel,
|
|
"BIMVFIInterpolate": BIMVFIInterpolate,
|
|
"BIMVFISegmentInterpolate": BIMVFISegmentInterpolate,
|
|
"TweenConcatVideos": TweenConcatVideos,
|
|
"LoadEMAVFIModel": LoadEMAVFIModel,
|
|
"EMAVFIInterpolate": EMAVFIInterpolate,
|
|
"EMAVFISegmentInterpolate": EMAVFISegmentInterpolate,
|
|
"LoadSGMVFIModel": LoadSGMVFIModel,
|
|
"SGMVFIInterpolate": SGMVFIInterpolate,
|
|
"SGMVFISegmentInterpolate": SGMVFISegmentInterpolate,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"LoadBIMVFIModel": "Load BIM-VFI Model",
|
|
"BIMVFIInterpolate": "BIM-VFI Interpolate",
|
|
"BIMVFISegmentInterpolate": "BIM-VFI Segment Interpolate",
|
|
"TweenConcatVideos": "Tween Concat Videos",
|
|
"LoadEMAVFIModel": "Load EMA-VFI Model",
|
|
"EMAVFIInterpolate": "EMA-VFI Interpolate",
|
|
"EMAVFISegmentInterpolate": "EMA-VFI Segment Interpolate",
|
|
"LoadSGMVFIModel": "Load SGM-VFI Model",
|
|
"SGMVFIInterpolate": "SGM-VFI Interpolate",
|
|
"SGMVFISegmentInterpolate": "SGM-VFI Segment Interpolate",
|
|
}
|