diff --git a/ldm/dream/args.py b/ldm/dream/args.py index 7a41094ded..375509251b 100644 --- a/ldm/dream/args.py +++ b/ldm/dream/args.py @@ -185,6 +185,7 @@ class Args(object): switches.append(f'-W {a["width"]}') switches.append(f'-H {a["height"]}') switches.append(f'-C {a["cfg_scale"]}') + switches.append(f'--fnformat {a["fnformat"]}') if a['perlin'] > 0: switches.append(f'--perlin {a["perlin"]}') if a['threshold'] > 0: @@ -559,6 +560,12 @@ class Args(object): type=float, help='Perlin noise scale (0.0 - 1.0) - add perlin noise to the initialization instead of the usual gaussian noise.', ) + render_group.add_argument( + '--fnformat', + default='%(prefix)s.%(seed)s.png', + type=str, + help='Specify the template of the generated files names.', + ) render_group.add_argument( '--grid', '-g', @@ -757,7 +764,7 @@ def metadata_dumps(opt, # remove any image keys not mentioned in RFC #266 rfc266_img_fields = ['type','postprocessing','sampler','prompt','seed','variations','steps', - 'cfg_scale','threshold','perlin','step_number','width','height','extra','strength'] + 'cfg_scale','threshold','perlin','fnformat','step_number','width','height','extra','strength'] rfc_dict ={} diff --git a/scripts/dream.py b/scripts/dream.py index cd0d7c33b4..365667484b 100644 --- a/scripts/dream.py +++ b/scripts/dream.py @@ -458,7 +458,23 @@ def prepare_image_metadata( if postprocessed and opt.save_original: filename = choose_postprocess_name(opt,prefix,seed) else: - filename = f'{prefix}.{seed}.png' + filename = opt.fnformat % { + 'prefix': prefix, + 'seed': seed, + 'steps': opt.steps, + 'prompt': opt.prompt, + 'width': opt.width, + 'height': opt.height, + 'cfg_scale': opt.cfg_scale, + 'perlin': opt.perlin, + 'threshold': opt.threshold, + 'gfpgan_strength': opt.gfpgan_strength, + 'outcrop': opt.outcrop, + 'upscale': opt.upscale, + 'embiggen': opt.embiggen, + 'embiggen_tiles': opt.embiggen_tiles, + 'out_direction': opt.out_direction + } if opt.variation_amount > 0: first_seed = first_seed or seed