mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
more pylint fixes
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -852,7 +852,7 @@ def control_run(state: str = '', # pylint: disable=keyword-arg-before-vararg
|
||||
html_txt = f'<p>Ready {image_txt}</p>' if image_txt != '' else ''
|
||||
if len(info_txt) > 0:
|
||||
html_txt = html_txt + infotext_to_html(info_txt[0])
|
||||
result = (output_images, blended_image, html_txt, output_filename)
|
||||
if is_generator:
|
||||
yield (output_images, blended_image, html_txt, output_filename)
|
||||
else:
|
||||
return (output_images, blended_image, html_txt, output_filename)
|
||||
yield result
|
||||
return result
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Union
|
||||
from diffusers import StableDiffusionPipeline, StableDiffusionXLPipeline, FluxPipeline, StableDiffusion3Pipeline, ControlNetModel
|
||||
from modules.control.units import detect
|
||||
from modules.shared import log, opts, cmd_opts, state, listdir
|
||||
from modules import errors, sd_models, devices, model_quant
|
||||
from modules import errors, sd_models, devices, model_quant # pylint: disable=unused-import
|
||||
from modules.processing import StableDiffusionProcessingControl
|
||||
|
||||
|
||||
@@ -318,27 +318,27 @@ class ControlNet():
|
||||
model_id = model_id or self.model_id
|
||||
if model_id is None or model_id == 'None':
|
||||
self.reset()
|
||||
return
|
||||
return ''
|
||||
if model_id not in all_models:
|
||||
log.error(f'Control {what}: id="{model_id}" available={list(all_models)} unknown model')
|
||||
return
|
||||
return ''
|
||||
model_path = all_models[model_id]
|
||||
if model_path == '':
|
||||
return
|
||||
return ''
|
||||
if model_path is None:
|
||||
log.error(f'Control {what} model load: id="{model_id}" unknown model id')
|
||||
return
|
||||
return ''
|
||||
if 'lora' in model_id.lower():
|
||||
self.model = model_path
|
||||
return
|
||||
return ''
|
||||
if model_id == self.model_id and not force:
|
||||
# log.debug(f'Control {what} model: id="{model_id}" path="{model_path}" already loaded')
|
||||
return
|
||||
return ''
|
||||
log.debug(f'Control {what} model loading: id="{model_id}" path="{model_path}"')
|
||||
cls, config = self.get_class(model_id)
|
||||
if cls is None:
|
||||
log.error(f'Control {what} model load: id="{model_id}" unknown base model')
|
||||
return
|
||||
return ''
|
||||
self.reset()
|
||||
jobid = state.begin(f'Load {what}')
|
||||
if model_path.endswith('.safetensors'):
|
||||
@@ -363,7 +363,7 @@ class ControlNet():
|
||||
if debug:
|
||||
errors.display(e, 'Control')
|
||||
if self.model is None:
|
||||
return
|
||||
return ''
|
||||
if not cmd_opts.lowvram: # lowvram will cause unet<->controlnet to ping-pong but saves more memory
|
||||
self.model.offload_never = True
|
||||
if self.dtype is not None:
|
||||
|
||||
@@ -90,19 +90,18 @@ class ControlLLLite():
|
||||
model_id = model_id or self.model_id
|
||||
if model_id is None or model_id == 'None':
|
||||
self.reset()
|
||||
return
|
||||
return ''
|
||||
if model_id not in all_models:
|
||||
log.error(f'Control {what} unknown model: id="{model_id}" available={list(all_models)}')
|
||||
return
|
||||
return ''
|
||||
model_path = all_models[model_id]
|
||||
if model_path == '':
|
||||
return
|
||||
return ''
|
||||
if model_path is None:
|
||||
log.error(f'Control {what} model load failed: id="{model_id}" error=unknown model id')
|
||||
return
|
||||
return ''
|
||||
if model_id == self.model_id and not force:
|
||||
# log.debug(f'Control {what} model: id="{model_id}" path="{model_path}" already loaded')
|
||||
return
|
||||
return ''
|
||||
log.debug(f'Control {what} model loading: id="{model_id}" path="{model_path}" {self.load_config}')
|
||||
if model_path.endswith('.safetensors'):
|
||||
self.model = ControlNetLLLite(model_path)
|
||||
|
||||
@@ -98,10 +98,10 @@ class Adapter():
|
||||
model_id = model_id or self.model_id
|
||||
if model_id is None or model_id == 'None':
|
||||
self.reset()
|
||||
return
|
||||
return ''
|
||||
if model_id not in all_models:
|
||||
log.error(f'Control {what} unknown model: id="{model_id}" available={list(all_models)}')
|
||||
return
|
||||
return ''
|
||||
model_path, model_args = all_models[model_id]
|
||||
self.load_config.update(model_args)
|
||||
from modules.shared import opts
|
||||
@@ -113,10 +113,9 @@ class Adapter():
|
||||
os.unsetenv('HF_HUB_OFFLINE')
|
||||
if model_path is None:
|
||||
log.error(f'Control {what} model load failed: id="{model_id}" error=unknown model id')
|
||||
return
|
||||
return ''
|
||||
if model_id == self.model_id and not force:
|
||||
# log.debug(f'Control {what} model: id="{model_id}" path="{model_path}" already loaded')
|
||||
return
|
||||
return ''
|
||||
log.debug(f'Control {what} model loading: id="{model_id}" path="{model_path}"')
|
||||
if model_path.endswith('.pth') or model_path.endswith('.pt') or model_path.endswith('.safetensors') or model_path.endswith('.bin'):
|
||||
from huggingface_hub import hf_hub_download
|
||||
|
||||
@@ -86,19 +86,18 @@ class ControlNetXS():
|
||||
model_id = model_id or self.model_id
|
||||
if model_id is None or model_id == 'None':
|
||||
self.reset()
|
||||
return
|
||||
return ''
|
||||
if model_id not in all_models:
|
||||
log.error(f'Control {what} unknown model: id="{model_id}" available={list(all_models)}')
|
||||
return
|
||||
return ''
|
||||
model_path = all_models[model_id]
|
||||
if model_path == '':
|
||||
return
|
||||
return ''
|
||||
if model_path is None:
|
||||
log.error(f'Control {what} model load failed: id="{model_id}" error=unknown model id')
|
||||
return
|
||||
return ''
|
||||
if model_id == self.model_id and not force:
|
||||
# log.debug(f'Control {what} model: id="{model_id}" path="{model_path}" already loaded')
|
||||
return
|
||||
return ''
|
||||
self.load_config['time_embedding_mix'] = time_embedding_mix
|
||||
if opts.offline_mode:
|
||||
self.load_config["local_files_only"] = True
|
||||
|
||||
+4
-7
@@ -104,10 +104,12 @@ main.ignore-paths=[
|
||||
".git",
|
||||
".ruff_cache",
|
||||
".vscode",
|
||||
".*/node_modules/.*",
|
||||
"modules/control/units/xs_pipe.py",
|
||||
"modules/control/proc",
|
||||
"modules/schedulers/scheduler_*.py",
|
||||
"modules/apg",
|
||||
"modules/cfgzero",
|
||||
"modules/control/proc",
|
||||
"modules/control/units",
|
||||
"modules/dml",
|
||||
"modules/face",
|
||||
"modules/flash_attn_triton_amd",
|
||||
@@ -125,7 +127,6 @@ main.ignore-paths=[
|
||||
"modules/seedvr",
|
||||
"modules/sharpfin",
|
||||
"modules/rife",
|
||||
"modules/schedulers",
|
||||
"modules/taesd",
|
||||
"modules/teacache",
|
||||
"modules/todo",
|
||||
@@ -158,11 +159,7 @@ main.ignore-paths=[
|
||||
"scripts/differential_diffusion.py",
|
||||
"scripts/pulid",
|
||||
"scripts/xadapter",
|
||||
"repositories",
|
||||
"extensions-builtin/sd-extension-chainner/nodes",
|
||||
"extensions-builtin/sd-webui-agent-scheduler",
|
||||
"extensions-builtin/sdnext-modernui/node_modules",
|
||||
"extensions-builtin/sdnext-kanvas/node_modules",
|
||||
]
|
||||
main.ignore-patterns=[
|
||||
".*test*.py$",
|
||||
|
||||
Reference in New Issue
Block a user