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.54k stars 2.42k forks source link

[bug]: Could not read metadata #1461

Closed apfelnymous closed 1 year ago

apfelnymous commented 1 year ago

Is there an existing issue for this?

OS

Linux

GPU

cuda

VRAM

6GB

What happened?

Can't read metadata ?!

invoke> !fix /home/apfelkomplott/Pictures/beautifulvampirewoman.png --outcrop top 128
>> fixing /home/apfelkomplott/Pictures/beautifulvampirewoman.png
>> could not read metadata
Traceback (most recent call last):
  File "/home/apfelkomplott/InvokeAI/ldm/invoke/args.py", line 1036, in metadata_loads
    images = [metadata['sd-metadata']['image']]
KeyError: 'image'

Screenshots

IndexError

Additional context

No response

Contact Details

No response

lstein commented 1 year ago

This is fixed in release 2.1.3, which should be released imminently.

apfelnymous commented 1 year ago

This is fixed in release 2.1.3, which should be released imminently.

Thanks, can't wait :)

downj05 commented 1 year ago

Had a similar issue, when no metadata is provided and I am using my own prompt (in my case with outcropping) it still excepts metadata and throws an uncaught error that crashes the entire script.

psychedelicious commented 1 year ago

@lstein Looks like there are still some issues with this

apfelnymous commented 1 year ago

What I forgot to mention: In this case an old dalle2 picture was used, but the error is the same when passing the --new_prompt tag along with it. Trying the same with a picture created with invoke works (except I run out of vram when it starts to generate)

So, anyone knows a handy metadata editor to initialize the needed attribute manually on the terminal ?

lstein commented 1 year ago

I'm afraid I can't reproduce the issue when I choose a random picture from the Internet that has no metadata in it. Here's a JPG of Beyonce accepting a Grammy nomination earlier this week: Beyonce-Grammys

And here's the outcropped image after extending 128 pixels at the bottom using --outcrop 128: Beyonce-Grammys 0 outcrop-01

This was using 2.1.3 and the inpainting-1.5 model. I didn't even add a prompt or seed and let it use its default seed of 0 and prompt of "". Can @apfelnymous and @downj05 confirm that you are both experiencing the problem in the new release? Maybe you could post images that are causing the bug to appear?

apfelnymous commented 1 year ago

@lstein I tried it with one random jpeg which worked, but then also 2 png which didn't. I pulled just now and updated the env, but how can I output the version to check ? This one doesn't work for instance: beautifulvampwoman Can you reproduce it with that one ?

lstein commented 1 year ago

I've made a pull request that will fix this bug, and it should appear in the next point release sometime this week.

Here is your outcropped vampire. I reduced her in size a bit for the purpose of debugging. For best results on a non-InvokeAI-generated image, please use the inpainting-1.5 model.

vampire-smaller 1817183064 outcrop

apfelnymous commented 1 year ago

Thx, I can avoid the matter until then by extending the pictures canvas and import it to inpaint the empty borders.

apfelnymous commented 1 year ago

Tested this in the 2.2 unified canvas webui and the CLI, works.