mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
Merge branch 'mashb1t:main' into load-upscale-strength-from-config
This commit is contained in:
@@ -375,11 +375,11 @@ def worker():
|
||||
ip_adapter.load_ip_adapter(clip_vision_path, ip_negative_path, ip_adapter_path)
|
||||
ip_adapter.load_ip_adapter(clip_vision_path, ip_negative_path, ip_adapter_face_path)
|
||||
|
||||
switch = int(round(steps * refiner_switch))
|
||||
|
||||
if overwrite_step > 0:
|
||||
steps = overwrite_step
|
||||
|
||||
switch = int(round(steps * refiner_switch))
|
||||
|
||||
if overwrite_switch > 0:
|
||||
switch = overwrite_switch
|
||||
|
||||
@@ -773,8 +773,7 @@ def worker():
|
||||
done_steps = current_task_id * steps + step
|
||||
async_task.yields.append(['preview', (
|
||||
int(15.0 + 85.0 * float(done_steps) / float(all_steps)),
|
||||
f'Sampling Image {current_task_id + 1}/{image_number}, Step {step + 1}/{total_steps} ...',
|
||||
y)])
|
||||
f'Sampling Image {current_task_id + 1}/{image_number}, Step {step + 1}/{total_steps} ...', y)])
|
||||
|
||||
for current_task_id, task in enumerate(tasks):
|
||||
execution_start_time = time.perf_counter()
|
||||
|
||||
+13
-1
@@ -137,6 +137,18 @@ def try_load_preset_global(preset):
|
||||
preset = args_manager.args.preset
|
||||
try_load_preset_global(preset)
|
||||
|
||||
def get_path_output(make_directory=False) -> str:
|
||||
"""
|
||||
Checking output path argument and overriding default path.
|
||||
"""
|
||||
global config_dict
|
||||
path_output = get_dir_or_set_default('path_outputs', '../outputs/', make_directory)
|
||||
if args_manager.args.output_path:
|
||||
print(f'[CONFIG] Overriding config value path_outputs with {args_manager.args.output_path}')
|
||||
config_dict['path_outputs'] = path_output = args_manager.args.output_path
|
||||
return path_output
|
||||
|
||||
|
||||
def get_dir_or_set_default(key, default_value, make_directory=False):
|
||||
global config_dict, visited_keys, always_save_keys
|
||||
|
||||
@@ -173,8 +185,8 @@ path_inpaint = get_dir_or_set_default('path_inpaint', '../models/inpaint/')
|
||||
path_controlnet = get_dir_or_set_default('path_controlnet', '../models/controlnet/')
|
||||
path_clip_vision = get_dir_or_set_default('path_clip_vision', '../models/clip_vision/')
|
||||
path_fooocus_expansion = get_dir_or_set_default('path_fooocus_expansion', '../models/prompt_expansion/fooocus_expansion')
|
||||
path_outputs = get_dir_or_set_default('path_outputs', '../outputs/', True)
|
||||
path_safety_checker_models = get_dir_or_set_default('path_safety_checker_models', '../models/safety_checker_models/')
|
||||
path_outputs = get_path_output(True)
|
||||
|
||||
|
||||
def get_config_item_or_set_default(key, default_value, validator, disable_empty_as_none=False):
|
||||
|
||||
@@ -15,7 +15,7 @@ from packaging.requirements import Requirement
|
||||
logging.getLogger("torch.distributed.nn").setLevel(logging.ERROR) # sshh...
|
||||
logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())
|
||||
|
||||
re_requirement = re.compile(r"\s*([-_a-zA-Z0-9]+)\s*(?:==\s*([-+_.a-zA-Z0-9]+))?\s*")
|
||||
re_requirement = re.compile(r"\s*([-\w]+)\s*(?:==\s*([-+.\w]+))?\s*")
|
||||
|
||||
python = sys.executable
|
||||
default_command_live = (os.environ.get('LAUNCH_LIVE_OUTPUT') == "1")
|
||||
|
||||
@@ -90,7 +90,7 @@ def log(img, metadata, metadata_parser: MetadataParser | None = None, output_for
|
||||
</script>"""
|
||||
)
|
||||
|
||||
begin_part = f"<html><head><title>Fooocus Log {date_string}</title>{css_styles}</head><body>{js}<p>Fooocus Log {date_string} (private)</p>\n<p>All images are clean, without any hidden data/meta, and safe to share with others.</p><!--fooocus-log-split-->\n\n"
|
||||
begin_part = f"<!DOCTYPE html><html><head><title>Fooocus Log {date_string}</title>{css_styles}</head><body>{js}<p>Fooocus Log {date_string} (private)</p>\n<p>All images are clean, without any hidden data/meta, and safe to share with others.</p><!--fooocus-log-split-->\n\n"
|
||||
end_part = f'\n<!--fooocus-log-split--></body></html>'
|
||||
|
||||
middle_part = log_cache.get(html_name, "")
|
||||
@@ -105,7 +105,7 @@ def log(img, metadata, metadata_parser: MetadataParser | None = None, output_for
|
||||
|
||||
div_name = only_name.replace('.', '_')
|
||||
item = f"<div id=\"{div_name}\" class=\"image-container\"><hr><table><tr>\n"
|
||||
item += f"<td><a href=\"{only_name}\" target=\"_blank\"><img src='{only_name}' onerror=\"this.closest('.image-container').style.display='none';\" loading='lazy'></img></a><div>{only_name}</div></td>"
|
||||
item += f"<td><a href=\"{only_name}\" target=\"_blank\"><img src='{only_name}' onerror=\"this.closest('.image-container').style.display='none';\" loading='lazy'/></a><div>{only_name}</div></td>"
|
||||
item += "<td><table class='metadata'>"
|
||||
for label, key, value in metadata:
|
||||
value_txt = str(value).replace('\n', ' </br> ')
|
||||
|
||||
+5
-2
@@ -173,13 +173,13 @@ def get_files_from_folder(folder_path, exensions=None, name_filter=None):
|
||||
relative_path = os.path.relpath(root, folder_path)
|
||||
if relative_path == ".":
|
||||
relative_path = ""
|
||||
for filename in sorted(files):
|
||||
for filename in sorted(files, key=lambda s: s.casefold()):
|
||||
_, file_extension = os.path.splitext(filename)
|
||||
if (exensions is None or file_extension.lower() in exensions) and (name_filter is None or name_filter in _):
|
||||
path = os.path.join(relative_path, filename)
|
||||
filenames.append(path)
|
||||
|
||||
return sorted(filenames, key=lambda x: -1 if os.sep in x else 1)
|
||||
return filenames
|
||||
|
||||
|
||||
def calculate_sha256(filename, length=HASH_SHA256_LENGTH) -> str:
|
||||
@@ -340,3 +340,6 @@ def is_json(data: str) -> bool:
|
||||
except (ValueError, AssertionError):
|
||||
return False
|
||||
return True
|
||||
|
||||
def ordinal_suffix(number: int) -> str:
|
||||
return 'th' if 10 <= number % 100 <= 20 else {1: 'st', 2: 'nd', 3: 'rd'}.get(number % 10, 'th')
|
||||
|
||||
Reference in New Issue
Block a user