mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
fix
This commit is contained in:
@@ -51,6 +51,19 @@ class Upscaler:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def find_folder(self, folder, scalers, loaded):
|
||||
for fn in os.listdir(folder): # from folder
|
||||
if not fn.endswith('.pth') and not fn.endswith('.pt'):
|
||||
continue
|
||||
file_name = os.path.join(folder, fn)
|
||||
if file_name not in loaded:
|
||||
model_name = os.path.splitext(fn)[0]
|
||||
scaler = UpscalerData(name=f'{self.name} {model_name}', path=file_name, upscaler=self)
|
||||
scaler.custom = True
|
||||
scalers.append(scaler)
|
||||
loaded.append(file_name)
|
||||
modules.shared.log.debug(f'Upscaler type={self.name} folder="{folder}" model="{model_name}" path="{file_name}"')
|
||||
|
||||
def find_scalers(self):
|
||||
scalers = []
|
||||
loaded = []
|
||||
@@ -66,6 +79,8 @@ class Upscaler:
|
||||
# modules.shared.log.debug(f'Upscaler type={self.name} folder="{self.user_path}" model="{model[0]}" path="{model_path}"')
|
||||
if not os.path.exists(self.user_path):
|
||||
return scalers
|
||||
self.find_folder(self.user_path, scalers, loaded)
|
||||
"""
|
||||
for fn in os.listdir(self.user_path): # from folder
|
||||
if not fn.endswith('.pth') and not fn.endswith('.pt'):
|
||||
continue
|
||||
@@ -77,6 +92,7 @@ class Upscaler:
|
||||
scalers.append(scaler)
|
||||
loaded.append(file_name)
|
||||
# modules.shared.log.debug(f'Upscaler type={self.name} folder="{self.user_path}" model="{model_name}" path="{file_name}"')
|
||||
"""
|
||||
return scalers
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -156,7 +156,7 @@ def initialize():
|
||||
|
||||
|
||||
def load_model():
|
||||
if opts.sd_checkpoint_autoload and shared.cmd_opts.ckpt.lower() != 'none':
|
||||
if opts.sd_checkpoint_autoload and (shared.cmd_opts.ckpt is not None and shared.cmd_opts.ckpt.lower() != 'none'):
|
||||
shared.state.begin('load')
|
||||
thread_model = Thread(target=lambda: shared.sd_model)
|
||||
thread_model.start()
|
||||
|
||||
Reference in New Issue
Block a user