From 0b7213dfd16b29a88b7701c77a252cfc744737e0 Mon Sep 17 00:00:00 2001 From: WolframRhodium Date: Sun, 22 Sep 2024 08:22:24 +0800 Subject: [PATCH] scripts/vsmlrt.py: add support for RIFE v4.26 model --- scripts/vsmlrt.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/vsmlrt.py b/scripts/vsmlrt.py index c36241f..60b60d4 100644 --- a/scripts/vsmlrt.py +++ b/scripts/vsmlrt.py @@ -1,4 +1,4 @@ -__version__ = "3.22.3" +__version__ = "3.22.4" __all__ = [ "Backend", "BackendV2", @@ -941,6 +941,7 @@ class RIFEModel(enum.IntEnum): v4_23 = 423 v4_24 = 424 v4_25 = 425 + v4_26 = 426 def RIFEMerge( @@ -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 ''}"