picobyte / stable-diffusion-webui-wd14-tagger

Labeling extension for Automatic1111's Web UI
580 stars 70 forks source link

"WD14 moat tagger V2" not working? #19

Closed Atoli closed 1 year ago

Atoli commented 1 year ago

When tried to use moat tagger i got the following error:

*** Error completing request
*** Arguments: (<PIL.Image.Image image mode=RGB size=1555x1920 at 0x1FF82014AF0>, 'WD14 moat tagger v2') {}
    Traceback (most recent call last):
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\utils\_errors.py", line 261, in hf_raise_for_status
        response.raise_for_status()
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/SmilingWolf/wd-v1-4-moat-tagger-v2/resolve/main/C%3A%5CUsers%5CPC%5CDesktop%5Cstable-diffusion-webui%5Cmodels%5Cinterrogators%5Cmodels--SmilingWolf--wd-v1-4-moat-tagger-v2%5Csnapshots%5C8452cddf280b952281b6e102411c50e981cb2908%5Cmodel.onnx

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "C:\Users\PC\Desktop\stable-diffusion-webui\modules\call_queue.py", line 55, in f
        res = list(func(*args, **kwargs))
      File "C:\Users\PC\Desktop\stable-diffusion-webui\modules\call_queue.py", line 35, in f
        res = func(*args, **kwargs)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-wd14-tagger\tagger\ui.py", line 80, in on_interrogate_image
        return interrogator.interrogate_image(image)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-wd14-tagger\tagger\interrogator.py", line 157, in interrogate_image
        data = ('', '', fi_key) + self.interrogate(image)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-wd14-tagger\tagger\interrogator.py", line 476, in interrogate
        self.load()
      File "C:\Users\PC\Desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-wd14-tagger\tagger\interrogator.py", line 459, in load
        self.download()
      File "C:\Users\PC\Desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-wd14-tagger\tagger\interrogator.py", line 427, in download
        self.model_path = hf_hub_download(
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
        return fn(*args, **kwargs)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\file_download.py", line 1195, in hf_hub_download
        metadata = get_hf_file_metadata(
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
        return fn(*args, **kwargs)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\file_download.py", line 1541, in get_hf_file_metadata
        hf_raise_for_status(r)
      File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\utils\_errors.py", line 271, in hf_raise_for_status
        raise EntryNotFoundError(message, response) from e
    huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: Root=1-64b703ec-5f4ac26f59b84daa707dcd7c;475d38c8-2ecd-48b7-a240-80cba4660f2a)

    Entry Not Found for url: https://huggingface.co/SmilingWolf/wd-v1-4-moat-tagger-v2/resolve/main/C%3A%5CUsers%5CPC%5CDesktop%5Cstable-diffusion-webui%5Cmodels%5Cinterrogators%5Cmodels--SmilingWolf--wd-v1-4-moat-tagger-v2%5Csnapshots%5C8452cddf280b952281b6e102411c50e981cb2908%5Cmodel.onnx.

---
Traceback (most recent call last):
  File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1229, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "C:\Users\PC\Desktop\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1204, in validate_outputs
    raise ValueError(
ValueError: An event handler (f) didn't receive enough output values (needed: 4, received: 3).
Wanted outputs:
    [html, label, label, html]
Received outputs:
    [None, "", "<div class='error'>EntryNotFoundError: 404 Client Error. (Request ID: Root=1-64b703ec-5f4ac26f59b84daa707dcd7c;475d38c8-2ecd-48b7-a240-80cba4660f2a)

Entry Not Found for url: https://huggingface.co/SmilingWolf/wd-v1-4-moat-tagger-v2/resolve/main/C%3A%5CUsers%5CPC%5CDesktop%5Cstable-diffusion-webui%5Cmodels%5Cinterrogators%5Cmodels--SmilingWolf--wd-v1-4-moat-tagger-v2%5Csnapshots%5C8452cddf280b952281b6e102411c50e981cb2908%5Cmodel.onnx.</div><div class='performance'><p class='time'>Time taken: <wbr>0.15s</p><p class='vram'>Torch active/reserved: 4095/4204 MiB, <wbr>Sys VRAM: 10179/12288 MiB (82.84%)</p></div>"]

All other models load normally.

coder168 commented 1 year ago

Same error here. But I found its little tricky, this error appear time to time. I am doing more tests to figure out how to replicate it reliably.

coder168 commented 1 year ago

After a quick check, what I found:

picobyte commented 1 year ago

There were errors initially, with the model_path for some, so I kind of fixed it, but indeed it may be a hack, I will have a look. It's just that the model_path may be a local path or a huggingface url path part. There do exist models that are not on huggingface and there does not seem to be a tightly followed standard in the file naming. You can also just send a pr and help out.

coder168 commented 1 year ago

As what I guess:

I wish this is helpful. Cheers.

picobyte commented 1 year ago

yes, I came to something similar, make one model_path a local_path, namely the one assigned in refresh_interrogators(), and only for WaifuDiffusionInterrogator, but I think there is one more change necessary.

coder168 commented 1 year ago

I did test with ML-Danbooru Caformer dec-5-97527, same error happened too. So at least MLDanbooruInterrogator should be fixed as well.

picobyte commented 1 year ago

so how about now? I must say I didn't try before, but I don't get the error now.

coder168 commented 1 year ago

WaifuDiffusionInterrogator related interrogators get fixed, but MLDanbooruInterrogator related interrogators (ML-Danbooru Caformer dec-5-97527 & ML-Danbooru TResNet-D 6-30000) still has the same errors as before.

How to replicate:

Note:

picobyte commented 1 year ago

thanks, it seems fixed now also for ML Danbooru

coder168 commented 1 year ago

Yes, I have finished some tests and my testing results show all interrogators for both MLDanbooruInterrogator & WaifuDiffusionInterrogator works fine after unload.

Thanks for your excellent work!

picobyte commented 1 year ago

Thank you too, for the clear reporting.