bes-dev / stable_diffusion.openvino

Apache License 2.0
1.53k stars 207 forks source link

Suddenly the produced images are totally different than before #142

Open smileBeda opened 1 year ago

smileBeda commented 1 year ago

I was running the image generation just fine for a few hours and then suddenly, the generated images changed completely.

For reference, I used portrait photo of a asia old warrior chief, tribal panther make up, blue on red, side profile, looking away, serious eyes, 50mm portrait photography, hard rim lighting photography–beta as prompt. It always generated quite acceptable images that more or less fit the prompt (see https://mpost.io/best-100-stable-diffusion-prompts-the-most-beautiful-ai-text-to-image-prompts/ for a reference as of how they look like)

And then all of a sudden, I get this kind of stuff: output

I did not alter the main class nor the stable_diffusion_engine.py file.

I even cleared the .cache folder

What is the cause of this sudden change? Nothing changed at all, the values are all the same as before.

brmarkus commented 1 year ago

Have you got an update via Huggingface-Hub (the locally downloaded files "expired" and got updated with a newer version online)?

smileBeda commented 1 year ago

How would that happen exactly? Like, I would have to ask/accept it, or is this automated? If it is automated.... it might be! If not, no, I did not update or pull anything else than what originally done following the #readme of this repo.

I might just scratch and start over, if it is an unusual behaviour... perhaps something stuck in some sort of cache?

brmarkus commented 1 year ago

Can you remember when you run the demo for the first time? Models were downloaded and stored in a local cache, e.g.:

Linux: /home/my_user_name/.cache/huggingface/hub/

MS-Windows: C:\Users\my_user_name.cache\huggingface\hub\

You might want to rename/make a backup/delete the cache and try again.

You have not changed anything else, not the source-code, not installing/updating/downgrading dependencies?

smileBeda commented 1 year ago

First time was like... 72 hours ago perhaps? I did delete that cache as soon I realised it is not working anymore, as I thought... well that could be related. And on the first image re-generation that cache was added again, yet still the same issue happened.

So definitely I would have the "latest" version of it as compared to what I maybe got initially...

Not changed anything else, no.

I will just re-install the thing. If it then still happens I guess I will come back here, otherwise, I'll update you here if its working

To clarify, once the .cache folder exists, it is NOT updated again automatically, right? What does it hold anyway? Are those the weights?

brmarkus commented 1 year ago

Have you set-up a e.g. Python virtu-env to ensure the overall system is not changed - and the overall system cannot change your environment (your e.g. Ubuntu-update-strategy might have updated/upgraded something "automatically")?

Yes, the cache holds the model-files ("topology-file" and "weight-file" for the OpenVINO IR-format). It even can hold multiple versions of a model if there was an update - there could even be different models (like a cartoon'ized variant; you can find other issues/questions about how to replace the model).

If you would not have deleted the cache you could have seen different versions - to then set e.g. symbolic links to switch to another locally cached version... I'm wouldn't know spontaneously how to specify which exact version to download. Where you able to find the Huggingface-Hub repo online?

The content in the cache can expire and would be updated automatically.

smileBeda commented 1 year ago

If you would not have deleted the cache you could have seen different versions - to then set e.g. symbolic links to switch to another locally cached version

How can I bring back the original? Do I have to fully re-install SD OpenVino?

The content in the cache can expire and would be updated automatically

Good to know! I guess that would fail on my install since I hard locked everything from write access unless the folders where the temporary cache and images are generated in. I will look at that closer.

Drake53 commented 1 year ago

hf_hub_download has an optional revision parameter that you can use to specify which version to download. In my fork I added an additional optional parameter '--model-revision' for this. You can find the commit hashes to use with this parameter here: https://huggingface.co/bes-dev/stable-diffusion-v1-4-openvino/commits/main

RedAndr commented 1 year ago

BTW, the files in the https://huggingface.co/bes-dev/stable-diffusion-v1-4-openvino/tree/main directory were updated two months ago. So, it shouldn't be it.