invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.33k stars 2.4k forks source link

[bug]: generated images differs from version prior to 2.1 #1411

Closed Neosettler closed 1 year ago

Neosettler commented 1 year ago

Is there an existing issue for this?

OS

Windows

GPU

cuda

VRAM

No response

What happened?

Comparing images from earlier version have a delta that is significant. @lstein is this related to the noise jumping from one algorithm to another? In any case, I'd like to know how to re-generated the exact same results has before. Hopping this is still an option.

thank you,

Screenshots

No response

Additional context

No response

Contact Details

No response

lstein commented 1 year ago

Are you using the k* samplers? If so, you can get to the old behavior by setting --karras_max=1000, or --karras_max=0, depending on which older version you are comparing to.

Neosettler commented 1 year ago

thank you for your input, several thousands of generated images with various samplers later, all metadata need to be updated to the new behavior.

Would you mind elaborating on "depending on which older version you are comparing to"? What value does what and from which previous versions? @lstein.

Neosettler commented 1 year ago

While this is not an issue for newly generated images, going back to previous generated images may be completely different. This issue should be considered as important as it breaks backward compatibility.

Neosettler commented 1 year ago

here is a example, while this one is quite subtle, in some cases, it makes a third arm popping up or a completely different image compared to version 2.0.

stable-diffusion-2022-11-09-230636-209505635 stable-diffusion-2022-11-07-154528-209505635

Is it possible to get previous behavior back? AFAIK, turning off the noise schedule?

lstein commented 1 year ago

If you set the --karras_max option on the command line when you start the script, then it will take effect on prompts that don't specifically have that option in the metadata, so you will have the old behavior back.

I can't advise you whether karras_max should be set to 0 or to 1000, because you haven't told me what version of InvokeAI you generated the old images from. At one point karras was turned off for everything, at another point karras was turned on for everything, and then we came up with a threshold at which it gets turned off selectively.

Neosettler commented 1 year ago

Thank you lstein, I've used releases only: 1.14 and 2.0 prior to 2.1.

I wish it would be that simple but in every cases, karras_max set to 0 or 1000 doesn't bring back the old behavior. My guess is that something other than the noise schedule might be adding to the delta.

PS: I've sent you a use case on Discord.

ebr commented 1 year ago

I also found some discrepancy between generations; this happened around the 2.1.3 release. I don't know enough about the internals to pinpoint what the root cause might be. Posted about it on Discord: https://discord.com/channels/1020123559063990373/1020123559831539744/1041613576537915432

from left to right ([date] branch), but unfortunately I don't have the record of specific commits I had checked out:

SD 1.5 model used in all cases.

Also, I did a full clean + preload models each time.

{
  "prompt": [
    {
      "prompt": "a futuristic cyberpunk flying vehicle, vaporwave palette, disco lights, bokeh, streets of a futuristic metropolis, crowds looking up, wide-angle action shot, style of Hiroaki Takahashi art ultra perfect composition 3d liquid detailing fluid acrylic by greg tocchini james gilleard joe fenton kaethe butcher Bosch Dan Mumford, Kandinsky art style [collage] [splatter] [streak] [crop] [cut]",
      "weight": 1
    }
  ],
  "steps": 35,
  "cfg_scale": 11,
  "threshold": 12.1,
  "perlin": 0.05,
  "height": 1024,
  "width": 1280,
  "seed": 3724352344,
  "seamless": false,
  "hires_fix": false,
  "postprocessing": [
    {
      "type": "esrgan",
      "scale": 4,
      "strength": 0.75
    }
  ],
  "sampler": "k_lms",
  "variations": [],
  "type": "txt2img"
}

Regarding karras: I made these with the web UI, and it seems that karras always gets turned on at 30 steps. Can't prove this, but I've never seen it any other way.

lstein commented 1 year ago

Just to let you know that I'm still investigating. If you've gained any insights, please let me know.

Neosettler commented 1 year ago

I've noticed that the "precision" also have an effect so it is important when comparing version that the "precision" is the same.