Integrates GIMM-VFI alongside existing BIM/EMA/SGM models. Key feature: generates all intermediate frames in one forward pass (no recursive 2x passes needed for 4x/8x). - Vendor gimm_vfi_arch/ from kijai/ComfyUI-GIMM-VFI with device fixes - Two variants: RAFT-based (~80MB) and FlowFormer-based (~123MB) - Auto-download checkpoints from HuggingFace (Kijai/GIMM-VFI_safetensors) - Three new nodes: Load GIMM-VFI Model, GIMM-VFI Interpolate, GIMM-VFI Segment Interpolate - single_pass toggle: True=arbitrary timestep (default), False=recursive like other models - ds_factor parameter for high-res input downscaling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1021 B
Python
43 lines
1021 B
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
|
|
# This source code is licensed under the license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
# --------------------------------------------------------
|
|
|
|
from torch import nn
|
|
import torch
|
|
|
|
|
|
# define siren layer & Siren model
|
|
class Sine(nn.Module):
|
|
"""Sine activation with scaling.
|
|
|
|
Args:
|
|
w0 (float): Omega_0 parameter from SIREN paper.
|
|
"""
|
|
|
|
def __init__(self, w0=1.0):
|
|
super().__init__()
|
|
self.w0 = w0
|
|
|
|
def forward(self, x):
|
|
return torch.sin(self.w0 * x)
|
|
|
|
|
|
# Damping activation from http://arxiv.org/abs/2306.15242
|
|
class Damping(nn.Module):
|
|
"""Sine activation with sublinear factor
|
|
|
|
Args:
|
|
w0 (float): Omega_0 parameter from SIREN paper.
|
|
"""
|
|
|
|
def __init__(self, w0=1.0):
|
|
super().__init__()
|
|
self.w0 = w0
|
|
|
|
def forward(self, x):
|
|
x = torch.clamp(x, min=1e-30)
|
|
return torch.sin(self.w0 * x) * torch.sqrt(x.abs())
|