diff --git a/ldm/invoke/generator/base.py b/ldm/invoke/generator/base.py index 3c6eca08a2..719d08c7c0 100644 --- a/ldm/invoke/generator/base.py +++ b/ldm/invoke/generator/base.py @@ -63,7 +63,7 @@ class Generator(): **kwargs ) results = [] - seed = seed if seed is not None else self.new_seed() + seed = seed if seed is not None and seed > 0 else self.new_seed() first_seed = seed seed, initial_noise = self.generate_initial_noise(seed, width, height) diff --git a/ldm/invoke/prompt_parser.py b/ldm/invoke/prompt_parser.py index 3dbcc1bb4b..42c83188aa 100644 --- a/ldm/invoke/prompt_parser.py +++ b/ldm/invoke/prompt_parser.py @@ -636,7 +636,7 @@ def split_weighted_subprompts(text, skip_normalize=False)->list: weight_sum = sum(map(lambda x: x[1], parsed_prompts)) if weight_sum == 0: print( - "Warning: Subprompt weights add up to zero. Discarding and using even weights instead.") + "* Warning: Subprompt weights add up to zero. Discarding and using even weights instead.") equal_weight = 1 / max(len(parsed_prompts), 1) return [(x[0], equal_weight) for x in parsed_prompts] return [(x[0], x[1] / weight_sum) for x in parsed_prompts] diff --git a/ldm/invoke/restoration/outcrop.py b/ldm/invoke/restoration/outcrop.py index 8b7b977759..1a0aaf2c8f 100644 --- a/ldm/invoke/restoration/outcrop.py +++ b/ldm/invoke/restoration/outcrop.py @@ -28,11 +28,12 @@ class Outcrop(object): self.generate._set_sampler() def wrapped_callback(img,seed,**kwargs): - image_callback(img,orig_opt.seed,use_prefix=prefix,**kwargs) + preferred_seed = orig_opt.seed if orig_opt.seed> 0 else seed + image_callback(img,preferred_seed,use_prefix=prefix,**kwargs) result= self.generate.prompt2image( - opt.prompt, - seed = opt.seed if opt.seed else orig_opt.seed, + orig_opt.prompt, + seed = orig_opt.seed if orig_opt.seed>0 else opt.seed, sampler = self.generate.sampler, steps = opt.steps, cfg_scale = opt.cfg_scale, diff --git a/scripts/invoke.py b/scripts/invoke.py index 031e56d3fa..50f995c26d 100755 --- a/scripts/invoke.py +++ b/scripts/invoke.py @@ -29,6 +29,7 @@ infile = None def main(): """Initialize command-line parsers and the diffusion model""" global infile + print('* Initializing, be patient...') opt = Args() args = opt.parse_args() @@ -46,7 +47,6 @@ def main(): print('--max_loaded_models must be >= 1; using 1') args.max_loaded_models = 1 - print('* Initializing, be patient...') from ldm.generate import Generate # these two lines prevent a horrible warning message from appearing @@ -668,7 +668,10 @@ def do_postprocess (gen, opt, callback): def add_postprocessing_to_metadata(opt,original_file,new_file,tool,command): original_file = original_file if os.path.exists(original_file) else os.path.join(opt.outdir,original_file) new_file = new_file if os.path.exists(new_file) else os.path.join(opt.outdir,new_file) - meta = retrieve_metadata(original_file)['sd-metadata'] + try: + meta = retrieve_metadata(original_file)['sd-metadata'] + except AttributeError: + meta = retrieve_metadata(new_file)['sd-metadata'] if 'image' not in meta: meta = metadata_dumps(opt,seeds=[opt.seed])['image'] meta['image'] = {}