Skip to content

Commit

Permalink
scripts/vsmlrt.py: add support for RIFE v4.26 model
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframRhodium committed Sep 22, 2024
1 parent 85424df commit 0b7213d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/vsmlrt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.22.3"
__version__ = "3.22.4"

__all__ = [
"Backend", "BackendV2",
Expand Down Expand Up @@ -941,6 +941,7 @@ class RIFEModel(enum.IntEnum):
v4_23 = 423
v4_24 = 424
v4_25 = 425
v4_26 = 426


def RIFEMerge(
Expand Down Expand Up @@ -995,17 +996,21 @@ def RIFEMerge(
else:
overlap_w, overlap_h = overlap

multiple_frac = 32 / Fraction(scale)
if multiple_frac.denominator != 1:
raise ValueError(f'{func_name}: (32 / Fraction(scale)) must be an integer')
multiple = int(multiple_frac.numerator)
scale = float(Fraction(scale))

model_major = int(str(int(model))[0])
model_minor = int(str(int(model))[1:3])
lite = "_lite" if len(str(int(model))) >= 4 else ""

if model_major == 4 and model_minor in (21, 22, 23, 25) and ensemble:
if (model_major, model_minor) >= (4, 26):
tilesize_requirement = 64
else:
tilesize_requirement = 32
multiple_frac = tilesize_requirement / Fraction(scale)
if multiple_frac.denominator != 1:
raise ValueError(f'{func_name}: ({tilesize_requirement} / Fraction(scale)) must be an integer')
multiple = int(multiple_frac.numerator)
scale = float(Fraction(scale))

if model_major == 4 and (model_minor in (21, 22, 23) or model_minor >= 25) and ensemble:
raise ValueError(f'{func_name}: ensemble is not supported')

version = f"v{model_major}.{model_minor}{lite}{'_ensemble' if ensemble else ''}"
Expand Down

0 comments on commit 0b7213d

Please sign in to comment.