mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
detect sdnq saved model
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -124,6 +124,8 @@ def guess_by_name(fn, current_guess):
|
||||
|
||||
def guess_by_diffusers(fn, current_guess):
|
||||
exclude_by_name = ['ostris/Flex.2-preview'] # pipeline may be misleading
|
||||
if not os.path.isdir(fn):
|
||||
return current_guess, None
|
||||
index = os.path.join(fn, 'model_index.json')
|
||||
if os.path.exists(index) and os.path.isfile(index):
|
||||
index = shared.readfile(index, silent=True)
|
||||
@@ -136,9 +138,12 @@ def guess_by_diffusers(fn, current_guess):
|
||||
if pipeline is None:
|
||||
pipeline = cls
|
||||
if callable(pipeline):
|
||||
is_quant = any(f for f in os.listdir(fn) if f.endswith('quantization_config.json'))
|
||||
pipelines = shared_items.get_pipelines()
|
||||
for k, v in pipelines.items():
|
||||
if v is not None and v.__name__ == pipeline.__name__:
|
||||
if is_quant:
|
||||
k = f'{k} SDNQ'
|
||||
return k, v
|
||||
return current_guess, None
|
||||
|
||||
|
||||
@@ -541,6 +541,11 @@ def load_diffuser_file(model_type, pipeline, checkpoint_info, diffusers_load_con
|
||||
return sd_model
|
||||
|
||||
|
||||
def load_sdnq_model(checkpoint_info, pipeline, diffusers_load_config, op):
|
||||
shared.log.error(f'Load {op}: model="{checkpoint_info.name}" cls={pipeline.__name__} args={diffusers_load_config} SDNQ pre-quant not supported')
|
||||
return None
|
||||
|
||||
|
||||
def set_overrides(sd_model, checkpoint_info):
|
||||
checkpoint_info_name = checkpoint_info.name.lower()
|
||||
if 'bigaspv25' in checkpoint_info_name or ('flow' in checkpoint_info_name and 'flower' not in checkpoint_info_name):
|
||||
@@ -657,6 +662,12 @@ def load_diffuser(checkpoint_info=None, op='model', revision=None): # pylint: di
|
||||
shared.log.error(f'Load {op}: type="{model_type}" pipeline="{pipeline}" not loaded')
|
||||
return
|
||||
|
||||
# load sdnq-prequantized model
|
||||
if sd_model is None:
|
||||
if model_type.endswith('SDNQ'):
|
||||
allow_post_quant = False
|
||||
sd_model = load_sdnq_model(checkpoint_info, pipeline, diffusers_load_config, op)
|
||||
|
||||
# load from hf folder-style
|
||||
if sd_model is None:
|
||||
if os.path.isdir(checkpoint_info.path) or checkpoint_info.type == 'huggingface' or checkpoint_info.type == 'transformer':
|
||||
|
||||
Reference in New Issue
Block a user