sd-dynamic-prompts icon indicating copy to clipboard operation
sd-dynamic-prompts copied to clipboard

Parameterized prompts with more than one parameter do not display evaluated prompt

Open demoran23 opened this issue 1 year ago • 3 comments

What's wrong

My prompt looks like this:

${subject=!he-man} 
${features=!with immaculate shoulder-length blonde hair}
${details=!with a fervent look in his eye}
${pose=!brandishing a sword above his head}
${setting=!a rocky crevasse}
${background=!greyskull castle looms in the background}

__promptgeek/prompt()__

00127-juggernaut_aftermath-DPM++ 2M Karras-16-3685966140-d6ebb8ea

I iterated over immediate evaluation (ie ! vs no !) and invoking the prompt vs not invoking it (ie prompt() vs prompt). I'm still left with metadata that looks like this:

Prompt: ${subject=!he-man}
${features=!with immaculate shoulder-length blonde hair}
${details=!with a fervent look in his eye}
${pose=!brandishing a sword above his head}
${setting=!a rocky crevasse}
${background=!greyskull castle looms in the background}
__promptgeek/prompt()__
Steps: 16 | Seed: 1362315855 | Sampler: DPM++ 2M Karras | CFG scale: 6 | Size: 768x768 | Parser: Full parser | Model: sd15_photorealistic_juggernaut_aftermath | Model hash: ba12f15e72 | VAE: vae-ft-mse-840000-ema-pruned | Latent sampler: UniPC | Image CFG scale: 6 | Denoising strength: 0.3 | Refiner start: 0.5 | Secondary steps: 20 | Version: 42c6147 | Pipeline: Original | Operations: "txt2img | hires" | CFG Rescale phi: 0 | Hires upscale: 1.5 | Hires steps: 20 | Hires upscaler: 4x-UltraSharp | Score: 6.97

The promptgeek prompt looks like this:

      __photorealistic/style__ photo of ${subject},
      ${features},
      ${details},
      ${pose},
      ${action},
      __photorealistic/framing__,
      ${setting},
      ${background},
      __photorealistic/lighting__,
      __photorealistic/camera/angle__,
      __photorealistic/camera/properties/shot_on**__,
      {1-$$__photorealistic/camera/properties/film_type__
        |__photorealistic/camera/properties/lens__
        |__photorealistic/camera/properties/filters_and_effects__},
      {3::_|1::in the style of __photorealistic/photographer__}

What works

When I comment out all of the other variables besides the subject, it works as expected: 00132-era09_v10-DPM++ 2M Karras-16-2639461381-870ea267

instant photo photo of he-man,
 
head shot,
 
soft fill lighting,
shot from a Dutch angle,
shot on Hasselblad 500CM,
Fujicolor Pro
  ,soft focus,
photorealistic,photographer

Steps: 16, Seed: 2639461381, Sampler: DPM++ 2M Karras, CFG scale: 6, Size: 768x768, Parser: Full parser, Model: sd15_photorealistic_era09_v10, Model hash: d03946b93d, VAE: vae-ft-mse-840000-ema-pruned, Latent sampler: UniPC, Image CFG scale: 6, Denoising strength: 0.3, Refiner start: 0.5, Secondary steps: 20, Version: 42c6147, Pipeline: Original, Operations: "txt2img, hires", CFG Rescale phi: 0, Hires upscale: 1.5, Hires steps: 20, Hires upscaler: 4x-UltraSharp, Score: 7.07, Hashes: {"vae": "735e4c3a44", "model": "d03946b93d"}

Re-enabling any of the other parameters causes the issue to happen again.

Without the actual resolved prompt being displayed, I have no idea what the prompt was that generated the image.

demoran23 avatar Jul 29 '23 18:07 demoran23

I've done some more investigation here, and changed my prompt to fix the issue.

It was blowing up because I either didn't specify default values for parameters and then omitted them.

The updated wildcard that works as expected:

      __photorealistic/style__ photo of ${subject:_},
      ${features:_},
      ${details:_},
      ${pose:_},
      ${action:_},
      __photorealistic/framing__,
      ${setting:_},
      ${background:_},
      __photorealistic/lighting__,
      __photorealistic/camera/angle__,
      __photorealistic/camera/properties/shot_on**__,
      {1-$$__photorealistic/camera/properties/film_type__
        |__photorealistic/camera/properties/lens__
        |__photorealistic/camera/properties/filters_and_effects__},
      {3::_|1::in the style of __photorealistic/photographer__}

demoran23 avatar Jul 29 '23 18:07 demoran23

What do you think would be a more reasonable approach to dealing with this:

  1. More explicit error message in the console
  2. Warning in the console and defaulting values to an empty string 3

adieyal avatar Aug 02 '23 06:08 adieyal

I think the parameterized invocation syntax template(x=abc) should accept multiple parameters.

The behavior of parameters should be documented

Throw an exception if any required parameters are missing that prevents the generation from proceeding

demoran23 avatar Aug 02 '23 11:08 demoran23