Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
# Adapted from Bandit (https://github.com/kwatcharasupat/source-separation), Copyright (c) the Bandit authors,
# Apache-2.0 (freevideo_engine/licenses/Bandit-Apache-2.0.txt). Modified: reduced to the inference subset.
from typing import Dict, Optional
import torch
import torchaudio as ta
from torch import nn
class _SpectralComponent(nn.Module):
def __init__(
self,
n_fft: int = 2048,
win_length: Optional[int] = 2048,
hop_length: int = 512,
window_fn: str = "hann_window",
wkwargs: Optional[Dict] = None,
power: Optional[int] = None,
center: bool = True,
normalized: bool = True,
pad_mode: str = "constant",
onesided: bool = True,
**kwargs,
) -> None:
super().__init__()
assert power is None
window_fn = torch.__dict__[window_fn]
self.stft = (
ta.transforms.Spectrogram(
n_fft=n_fft,
win_length=win_length,
hop_length=hop_length,
pad_mode=pad_mode,
pad=0,
window_fn=window_fn,
wkwargs=wkwargs,
power=power,
normalized=normalized,
center=center,
onesided=onesided,
)
)
self.istft = (
ta.transforms.InverseSpectrogram(
n_fft=n_fft,
win_length=win_length,
hop_length=hop_length,
pad_mode=pad_mode,
pad=0,
window_fn=window_fn,
wkwargs=wkwargs,
normalized=normalized,
center=center,
onesided=onesided,
)
)