prevent crashes due to uninitialized free_gpu_mem

This commit is contained in:
Lincoln Stein 2022-10-06 10:54:05 -04:00
parent f3050fefce
commit 2154dd2349
2 changed files with 5 additions and 4 deletions

View File

@ -174,7 +174,8 @@ class Generate:
config = None,
gfpgan=None,
codeformer=None,
esrgan=None
esrgan=None,
free_gpu_mem=False,
):
models = OmegaConf.load(conf)
mconfig = models[model]
@ -201,6 +202,7 @@ class Generate:
self.gfpgan = gfpgan
self.codeformer = codeformer
self.esrgan = esrgan
self.free_gpu_mem = free_gpu_mem
# Note that in previous versions, there was an option to pass the
# device to Generate(). However the device was then ignored, so

View File

@ -75,7 +75,8 @@ def main():
precision = opt.precision,
gfpgan=gfpgan,
codeformer=codeformer,
esrgan=esrgan
esrgan=esrgan,
free_gpu_mem=opt.free_gpu_mem,
)
except (FileNotFoundError, IOError, KeyError) as e:
print(f'{e}. Aborting.')
@ -104,8 +105,6 @@ def main():
# preload the model
gen.load_model()
#set additional option
gen.free_gpu_mem = opt.free_gpu_mem
# web server loops forever
if opt.web or opt.gui: