Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed Dec 15, 2024
1 parent b512d2a commit d5c9087
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions backend/src/pytorch/InterpolateTorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def dynamicScaleCalculation(self,frame1):
def __call__(self, img1, writeQueue:Queue, transition=False, upscaleModel:UpscalePytorch = None): # type: ignore
"""Perform processing"""

def initLog(self):
printAndLog("Using device: " + str(self.device))
printAndLog("Using dtype: " + str(self.dtype))

@torch.inference_mode()
def norm(self, frame: torch.Tensor):
return (
Expand Down Expand Up @@ -148,25 +152,29 @@ def __init__(
dtype: str = "auto",
backend: str = "pytorch",
UHDMode: bool = False,
ensemble: bool = False,
dynamicScaledOpticalFlow: bool = False,
*args,
**kwargs,
):

printAndLog("Using device: " + str(device))

self.interpolateModel = modelPath
self.width = width
self.height = height
self.device = self.handleDevice(device)
self.dtype = self.handlePrecision(dtype)
if ensemble:
print("Ensemble is not implemented for GIMM, disabling", file=sys.stderr)
if dynamicScaledOpticalFlow:
print("Dynamic Scaled Optical Flow is not implemented for GIMM, disabling",file=sys.stderr)

self.backend = backend
self.ceilInterpolateFactor = ceilInterpolateFactor
self.frame0 = None
self.scale = 0.5 # GIMM uses fat amounts of vram, needs really low flow resolution for regular resolutions
if UHDMode:
self.scale = 0.25 # GIMM uses fat amounts of vram, needs really low flow resolution for UHD
self.doEncodingOnFrame = False

self.initLog()
self._load()

@torch.inference_mode()
Expand Down Expand Up @@ -285,8 +293,6 @@ def __init__(
*args,
**kwargs,
):


self.frame0 = None
self.interpolateModel = modelPath
self.width = width
Expand Down Expand Up @@ -409,13 +415,14 @@ def __init__(
*args,
**kwargs,
):
printAndLog("Using device: " + str(device))

self.interpolateModel = modelPath
self.width = width
self.height = height

self.device:torch.device = self.handleDevice(device)
self.dtype = self.handlePrecision(dtype)
self.initLog()
self.backend = backend
self.ceilInterpolateFactor = ceilInterpolateFactor
self.dynamicScaledOpticalFlow = dynamicScaledOpticalFlow
Expand Down

0 comments on commit d5c9087

Please sign in to comment.