mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
restore default sampler on mismatch
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ def check_cache(opts):
|
||||
from modules.modelstats import stat
|
||||
if opts.hfcache_dir != prev_default:
|
||||
size, _mtime = stat(prev_default)
|
||||
if (size//1024//1024 > 0):
|
||||
if size//1024//1024 > 0:
|
||||
log.warning(f'Cache location changed: previous="{prev_default}" size={size//1024//1024} MB')
|
||||
size, _mtime = stat(opts.hfcache_dir)
|
||||
log.debug(f'Huggingface cache: path="{opts.hfcache_dir}" size={size//1024//1024} MB')
|
||||
|
||||
@@ -78,7 +78,7 @@ def create_sampler(name, model):
|
||||
if model is not None:
|
||||
if getattr(model, "default_scheduler", None) is None:
|
||||
model.default_scheduler = copy.deepcopy(model.scheduler)
|
||||
requires_flow = ('FlowMatch' in model.default_scheduler.__class__.__name__) or (getattr(model.scheduler.config, 'prediction_type', None) == 'flow_prediction')
|
||||
requires_flow = ('FlowMatch' in model.default_scheduler.__class__.__name__) or (getattr(model.default_scheduler.config, 'prediction_type', None) == 'flow_prediction')
|
||||
else:
|
||||
requires_flow = False
|
||||
|
||||
@@ -98,7 +98,7 @@ def create_sampler(name, model):
|
||||
# validate sampler prediction type
|
||||
if (model is not None) and (is_flow and not requires_flow):
|
||||
shared.log.error(f'Sampler: "{sampler.name}" cls={sampler.sampler.__class__.__name__} pipe={model.__class__.__name__} model requires sampler with discrete prediction')
|
||||
# return restore_default(model)
|
||||
return restore_default(model)
|
||||
if (model is not None) and (not is_flow and requires_flow):
|
||||
shared.log.error(f'Sampler: "{sampler.name}" cls={sampler.sampler.__class__.__name__} pipe={model.__class__.__name__} model requires sampler with flow prediction')
|
||||
return restore_default(model)
|
||||
|
||||
Reference in New Issue
Block a user