mirror of https://github.com/vladmandic/automatic
parent
7a409a9e83
commit
12fd4d30f1
|
|
@ -526,7 +526,8 @@ def create_model_from_signature(func: Callable, model_name: str, base_model: typ
|
||||||
args.remove(arg)
|
args.remove(arg)
|
||||||
non_default_args = len(args) - len(defaults)
|
non_default_args = len(args) - len(defaults)
|
||||||
defaults = (...,) * non_default_args + defaults
|
defaults = (...,) * non_default_args + defaults
|
||||||
keyword_only_params = {param: kwonlydefaults.get(param, Any) for param in kwonlyargs}
|
kw_defaults = kwonlydefaults or {}
|
||||||
|
keyword_only_params = {param: (annotations.get(param, Any), kw_defaults.get(param, ...)) for param in kwonlyargs}
|
||||||
for k, v in annotations.items():
|
for k, v in annotations.items():
|
||||||
if v == list[Image.Image]:
|
if v == list[Image.Image]:
|
||||||
annotations[k] = list[str]
|
annotations[k] = list[str]
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ class FilenameGenerator:
|
||||||
default_time_format = '%Y%m%d%H%M%S'
|
default_time_format = '%Y%m%d%H%M%S'
|
||||||
|
|
||||||
def __init__(self, p=None, seed:int=-1, prompt:str='', image=None, grid=False, width=None, height=None):
|
def __init__(self, p=None, seed:int=-1, prompt:str='', image=None, grid=False, width=None, height=None):
|
||||||
|
self.p = p
|
||||||
if p is None:
|
if p is None:
|
||||||
debug_log('Filename generator init skip')
|
debug_log('Filename generator init skip')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
debug_log(f'Filename generator init: seed={seed} prompt="{prompt}"')
|
debug_log(f'Filename generator init: seed={seed} prompt="{prompt}"')
|
||||||
self.p = p
|
|
||||||
if seed is not None and int(seed) > 0:
|
if seed is not None and int(seed) > 0:
|
||||||
self.seed = seed
|
self.seed = seed
|
||||||
elif p is not None and getattr(p, 'all_seeds', None) is not None and len(p.all_seeds) > 0:
|
elif p is not None and getattr(p, 'all_seeds', None) is not None and len(p.all_seeds) > 0:
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,10 @@ def set_pipeline_args(p, model, prompts:list, negative_prompts:list, prompts_2:l
|
||||||
if 'use_mask_in_transformer' in possible:
|
if 'use_mask_in_transformer' in possible:
|
||||||
args['use_mask_in_transformer'] = shared.opts.te_use_mask
|
args['use_mask_in_transformer'] = shared.opts.te_use_mask
|
||||||
|
|
||||||
timesteps = re.split(',| ', shared.opts.schedulers_timesteps)
|
sched_timesteps = getattr(p, 'schedulers_timesteps', None)
|
||||||
|
if sched_timesteps is None:
|
||||||
|
sched_timesteps = shared.opts.schedulers_timesteps
|
||||||
|
timesteps = re.split(',| ', sched_timesteps)
|
||||||
if len(timesteps) > 2:
|
if len(timesteps) > 2:
|
||||||
if ('timesteps' in possible) and hasattr(model.scheduler, 'set_timesteps') and ("timesteps" in set(inspect.signature(model.scheduler.set_timesteps).parameters.keys())):
|
if ('timesteps' in possible) and hasattr(model.scheduler, 'set_timesteps') and ("timesteps" in set(inspect.signature(model.scheduler.set_timesteps).parameters.keys())):
|
||||||
p.timesteps = [int(x) for x in timesteps if x.isdigit()]
|
p.timesteps = [int(x) for x in timesteps if x.isdigit()]
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ def set_caption_load_options():
|
||||||
else:
|
else:
|
||||||
sd_hijack_accelerate.restore_accelerate()
|
sd_hijack_accelerate.restore_accelerate()
|
||||||
if (shared.opts.runai_streamer_diffusers or shared.opts.runai_streamer_transformers) and (sys.platform == 'linux'):
|
if (shared.opts.runai_streamer_diffusers or shared.opts.runai_streamer_transformers) and (sys.platform == 'linux'):
|
||||||
log.debug(f'Caption loader: to_gpu={shared.opts.caption_to_gpu} runai chunk={os.environ["RUNAI_STREAMER_CHUNK_BYTESIZE"]} limit={os.environ["RUNAI_STREAMER_MEMORY_LIMIT"]}')
|
log.debug(f'Caption loader: to_gpu={shared.opts.caption_to_gpu} runai chunk={os.environ.get("RUNAI_STREAMER_CHUNK_BYTESIZE", "N/A")} limit={os.environ.get("RUNAI_STREAMER_MEMORY_LIMIT", "N/A")}')
|
||||||
sd_hijack_safetensors.hijack_safetensors(shared.opts.runai_streamer_diffusers, shared.opts.runai_streamer_transformers)
|
sd_hijack_safetensors.hijack_safetensors(shared.opts.runai_streamer_diffusers, shared.opts.runai_streamer_transformers)
|
||||||
else:
|
else:
|
||||||
if shared.opts.caption_to_gpu:
|
if shared.opts.caption_to_gpu:
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,9 @@ def move_aux_to_gpu(name: str) -> None:
|
||||||
# 1. Evict other auxiliary models first
|
# 1. Evict other auxiliary models first
|
||||||
evict_aux(exclude=name, reason='pre')
|
evict_aux(exclude=name, reason='pre')
|
||||||
# 2. If balanced offload active, evict diffusers pipeline modules if memory is tight
|
# 2. If balanced offload active, evict diffusers pipeline modules if memory is tight
|
||||||
from modules.sd_offload import apply_balanced_offload
|
if shared.sd_loaded:
|
||||||
shared.sd_model = apply_balanced_offload(shared.sd_model)
|
from modules.sd_offload import apply_balanced_offload
|
||||||
|
shared.sd_model = apply_balanced_offload(shared.sd_model)
|
||||||
# 3. Move to GPU (stream + sync)
|
# 3. Move to GPU (stream + sync)
|
||||||
if shared.opts.diffusers_offload_streams:
|
if shared.opts.diffusers_offload_streams:
|
||||||
global move_stream # pylint: disable=global-statement
|
global move_stream # pylint: disable=global-statement
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ rich==14.1.0
|
||||||
safetensors==0.7.0
|
safetensors==0.7.0
|
||||||
peft==0.18.1
|
peft==0.18.1
|
||||||
httpx==0.28.1
|
httpx==0.28.1
|
||||||
compel==2.2.1
|
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
tqdm==4.67.3
|
tqdm==4.67.3
|
||||||
accelerate==1.12.0
|
accelerate==1.12.0
|
||||||
|
|
|
||||||
2
webui.py
2
webui.py
|
|
@ -364,6 +364,8 @@ def start_ui():
|
||||||
log.info(f'API redocs: {local_url[:-1]}/redocs') # pylint: disable=unsubscriptable-object
|
log.info(f'API redocs: {local_url[:-1]}/redocs') # pylint: disable=unsubscriptable-object
|
||||||
if share_url is not None:
|
if share_url is not None:
|
||||||
log.info(f'Share URL: {share_url}')
|
log.info(f'Share URL: {share_url}')
|
||||||
|
if getattr(shared.cmd_opts, 'enso', False):
|
||||||
|
log.info(f'Enso URL: {local_url[:-1]}/enso') # pylint: disable=unsubscriptable-object
|
||||||
# log.debug(f'Gradio functions: registered={len(shared.demo.fns)}')
|
# log.debug(f'Gradio functions: registered={len(shared.demo.fns)}')
|
||||||
shared.demo.server.wants_restart = False
|
shared.demo.server.wants_restart = False
|
||||||
modules.api.middleware.setup_middleware(app, shared.cmd_opts)
|
modules.api.middleware.setup_middleware(app, shared.cmd_opts)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue