kohya-ss / sd-webui-additional-networks

GNU Affero General Public License v3.0
1.78k stars 296 forks source link

failing to load/edit metadata on some new models #97

Closed Robonau closed 1 year ago

Robonau commented 1 year ago

TzF4LNE

lora: https://civitai.com/models/7466

apparently made using the "latest kohya trainer" as mentioned in https://civitai.com/models/7466?commentId=21696&modal=commentThread

  File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1015, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 833, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/stable-diffusion-webui/extensions/sd-webui-additional-networks/scripts/metadata_editor.py", line 249, in refresh_metadata
    count_max = max(top_tags.values())
ValueError: max() arg is an empty sequence

is the error in console

is only happening with vary new loras older ones still load and edit metadata fine

kohya-ss commented 1 year ago

Thank you for reporting. I will check it.

kohya-ss commented 1 year ago

I've fixed a bug. Please update the extension.

The model trained with the metadata json and there is no tag in the metadata, the model has the empty tag frequency, and it crashes the metadata editor.