mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
@@ -170,8 +170,8 @@ class FilenameGenerator:
|
||||
# starting reference: <https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file>
|
||||
invalid_chars = (
|
||||
"#<>/\\\"'`" # ASCII quote and backtick
|
||||
"’‚‛\u2018\u2019\u201B" # smart single quotes and variants
|
||||
"\u02BB" # modifier letter turned comma (ʻ)
|
||||
"’‚‛\u2018\u2019\u201B" # smart single quotes and variants # noqa: RUF001
|
||||
"\u02BB" # modifier letter turned comma
|
||||
"\u201C\u201D\u201F" # smart double quotes and variants
|
||||
"|?*^%$\u00A0\u2013\u2014\n\t\r" # pipes, wildcards, percent, currency, NBSP, dashes, control chars
|
||||
)
|
||||
|
||||
@@ -95,23 +95,19 @@ def diffusers_callback(pipe, step: int = 0, timestep: int = 0, kwargs: dict = {}
|
||||
kwargs = prompt_callback(step, kwargs) # monkey patch for diffusers callback issues
|
||||
|
||||
if step == 0:
|
||||
setattr(pipe, "_cfg_end_applied", False)
|
||||
pipe._cfg_end_applied = False # pylint: disable=protected-access
|
||||
|
||||
cfg_end = getattr(p, "cfg_end", 1.0) or 1.0
|
||||
total_steps = getattr(pipe, "num_timesteps", 0)
|
||||
target_step = int(total_steps * cfg_end) if total_steps else 0
|
||||
if (
|
||||
cfg_end < 1.0
|
||||
and not getattr(pipe, "_cfg_end_applied", False)
|
||||
and step >= target_step
|
||||
):
|
||||
setattr(pipe, "_cfg_end_applied", True)
|
||||
if (cfg_end < 1.0) and not getattr(pipe, "_cfg_end_applied", False) and (step >= target_step):
|
||||
pipe._cfg_end_applied = True # pylint: disable=protected-access
|
||||
if "PAG" in shared.sd_model.__class__.__name__:
|
||||
pipe._guidance_scale = 1.001 if pipe._guidance_scale > 1 else pipe._guidance_scale # pylint: disable=protected-access
|
||||
pipe._pag_scale = 0.001 # pylint: disable=protected-access
|
||||
else:
|
||||
pipe._guidance_scale = 0.0 # pylint: disable=protected-access
|
||||
for key in {"prompt_embeds", "negative_prompt_embeds", "add_text_embeds", "add_time_ids"}:
|
||||
for key in ["prompt_embeds", "negative_prompt_embeds", "add_text_embeds", "add_time_ids"]:
|
||||
tensor = kwargs.get(key, None)
|
||||
if tensor is not None and hasattr(tensor, "chunk") and tensor.shape[0] % 2 == 0:
|
||||
kwargs[key] = tensor.chunk(2)[-1]
|
||||
|
||||
Reference in New Issue
Block a user