zixaphir / Stable-Diffusion-Webui-Civitai-Helper

Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
175 stars 24 forks source link

Handling non-standard ss_tag_frequency properties. #103

Closed brendanhoar closed 1 month ago

brendanhoar commented 2 months ago

Have you read document?

Yes.

Have you checked console log window's msg?

Yes.

Describe Issue

When parsing metadata of a model with a string ss_tag_frequency value, scanning stops, as there is no keys() property. This prevents processing any remaining models. The workaround is to move the offending model(s) elsewhere temporarily until scanning is completed.

My suggestion would be to update models_action_civit.py with insertion of something like the following on (current) line 236 (and indenting as appropriate after):

if tag_frequency is not None and hasattr(tag_frequency, 'keys'):

That does prevent the offending model from blocking processing but it also does not parse the non-standard value. This is better than the current result, IMO.

B

zixaphir commented 2 months ago

Thank you for your suggestion. It was my assumption that ss_tag_frequency was treated somewhat as a defacto standard in terms of how it was populated. This unfortunately makes things more difficult and is the second time in recent memory that I've seen it treated differently than I assumed. I added the functionality to scan it for values because it at least provided some hinting about how training data was setup in the case the proper model metadata was not found, so by scanning this property, I could get a list of potential activation words that would give the user potential to use an undocumented model. I will try to add some alternative methods of reading it and then an actual error state to handle failures more gracefully.

brendanhoar commented 2 months ago

Thanks for the response.

In the first case I saw, there was json data about the tags in that object...but the format differed. I'll see if I can dig out the example.

You're not the only one who expected a standard format!

I've pulled a lot of models from all over, so I'm a good test bed for metadata assumptions...

Also, I have a similar change request I need to send to A1111 on this, since the sd_model.py code also makes some assumptions about that object too, to the point of also stopping the Civitai data gathering under some circumstances. After work...

B

zixaphir commented 1 month ago

https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/commit/f5161d36f6d660a40728af8e1336c673fbe8824d