From 47ed9b2d398287f14a6dcab6fa4fe8b78bccf1c8 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:39:31 +0900 Subject: [PATCH] allow list or callables in generation_params --- modules/processing.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/processing.py b/modules/processing.py index c1e689c37..50570c49b 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -756,6 +756,16 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter "User": p.user if opts.add_user_name_to_info else None, } + for key, value in generation_params.items(): + try: + if isinstance(value, list): + generation_params[key] = value[index] + elif callable(value): + generation_params[key] = value(**locals()) + except Exception: + errors.report(f'Error creating infotext for key "{key}"', exc_info=True) + generation_params[key] = None + if all_hr_prompts := all_hr_prompts or getattr(p, 'all_hr_prompts', None): generation_params['Hires prompt'] = all_hr_prompts[index] if all_hr_prompts[index] != all_prompts[index] else None if all_hr_negative_prompts := all_hr_negative_prompts or getattr(p, 'all_hr_negative_prompts', None):