Skip to content

Commit

Permalink
fix ncnn
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed Nov 26, 2024
1 parent a7fecaf commit 2ea5225
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/ui/ProcessTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ def __init__(self, parent, gmfssSupport: bool):
self.QConnect()
self.populateModels(self.parent.backendComboBox.currentText())

def populateModels(self, backend) -> dict:
def getModels(self,backend):
"""
returns
the current models available given a method (interpolate, upscale) and a backend (ncnn, tensorrt, pytorch)
returns models based on backend, used for populating the model comboboxes [interpolate, upscale]
"""
match backend:
case "ncnn":
Expand All @@ -79,7 +78,14 @@ def populateModels(self, backend) -> dict:
)
errorAndLog("Failed to import any backends!")
return {}

return interpolateModels,upscaleModels

def populateModels(self, backend) -> dict:
"""
returns
the current models available given a method (interpolate, upscale) and a backend (ncnn, tensorrt, pytorch)
"""
interpolateModels,upscaleModels = self.getModels(backend)
self.parent.interpolateModelComboBox.clear()
self.parent.upscaleModelComboBox.clear()
self.parent.interpolateModelComboBox.addItems(['None'] + list(interpolateModels.keys()))
Expand Down Expand Up @@ -193,6 +199,7 @@ def run(
interpolateModel: str,
benchmarkMode: bool,
):
interpolateModels,upscaleModels = self.getModels(backend)
if interpolateModel == "None":
interpolateModel = None
interpolateModelFile = None
Expand All @@ -218,14 +225,15 @@ def run(
"""
self.benchmarkMode = benchmarkMode
# get model attributes

if interpolateModel:
interpolateModelFile,interpolateDownloadFile = totalModels[interpolateModel][0], totalModels[interpolateModel][1]
interpolateModelFile,interpolateDownloadFile = interpolateModels[interpolateModel][0], interpolateModels[interpolateModel][1]
else:
interpolateTimes = 1
if upscaleModel:
upscaleModelFile, upscaleDownloadFile = totalModels[upscaleModel][0], totalModels[upscaleModel][1]
upscaleTimes = totalModels[upscaleModel][2]
upscaleModelArch = totalModels[upscaleModel][3]
upscaleModelFile, upscaleDownloadFile = upscaleModels[upscaleModel][0], upscaleModels[upscaleModel][1]
upscaleTimes = upscaleModels[upscaleModel][2]
upscaleModelArch = upscaleModels[upscaleModel][3]
else:
upscaleTimes = 1
upscaleModelArch = "custom"
Expand Down Expand Up @@ -314,8 +322,6 @@ def renderToPipeThread(self, backend: str, interpolateTimes: int, interpolateMod
command += [
"--upscale_model",
modelPath,
"--interpolate_factor",
"1",
]
if self.tilingEnabled:
command += [
Expand Down

0 comments on commit 2ea5225

Please sign in to comment.