stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Error while using "Interrogate" on img2img

Open Angelixus opened this issue 2 years ago • 3 comments

Describe the bug Having a photo on img2img on the "Inpainting" tab and clicking "Interrogate gives the next error"

Error interrogating
Traceback (most recent call last):
  File "/content/stable-diffusion-webui/modules/interrogate.py", line 137, in interrogate
    caption = self.generate_caption(pil_image)
  File "/content/stable-diffusion-webui/modules/interrogate.py", line 119, in generate_caption
    ])(pil_image).unsqueeze(0).type(self.dtype).to(shared.device)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 94, in __call__
    img = t(img)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 349, in forward
    return F.resize(img, self.size, self.interpolation, self.max_size, self.antialias)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py", line 430, in resize
    return F_pil.resize(img, size=size, interpolation=pil_interpolation, max_size=max_size)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional_pil.py", line 249, in resize
    raise TypeError(f"img should be PIL Image. Got {type(img)}")
TypeError: img should be PIL Image. Got <class 'NoneType'>

Traceback (most recent call last):
  File "/content/stable-diffusion-webui/modules/interrogate.py", line 137, in interrogate
    caption = self.generate_caption(pil_image)
  File "/content/stable-diffusion-webui/modules/interrogate.py", line 119, in generate_caption
    ])(pil_image).unsqueeze(0).type(self.dtype).to(shared.device)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 94, in __call__
    img = t(img)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 349, in forward
    return F.resize(img, self.size, self.interpolation, self.max_size, self.antialias)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py", line 430, in resize
    return F_pil.resize(img, size=size, interpolation=pil_interpolation, max_size=max_size)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional_pil.py", line 249, in resize
    raise TypeError(f"img should be PIL Image. Got {type(img)}")
TypeError: img should be PIL Image. Got <class 'NoneType'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/gradio/routes.py", line 274, in run_predict
    fn_index, raw_input, username, session_state, iterators
  File "/usr/local/lib/python3.7/dist-packages/gradio/blocks.py", line 742, in process_api
    result = await self.call_function(fn_index, inputs, iterator)
  File "/usr/local/lib/python3.7/dist-packages/gradio/blocks.py", line 654, in call_function
    block_fn.fn, *processed_input, limiter=self.limiter
  File "/usr/local/lib/python3.7/dist-packages/anyio/to_thread.py", line 32, in run_sync
    func, *args, cancellable=cancellable, limiter=limiter
  File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/content/stable-diffusion-webui/modules/ui.py", line 310, in interrogate
    prompt = shared.interrogator.interrogate(image)
  File "/content/stable-diffusion-webui/modules/interrogate.py", line 164, in interrogate
    res += "<error>"
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

Expected behavior Interrogate should create a prompt

Additional context Found using Akaibu's colab notebook and being up to date with this commit

Angelixus avatar Oct 04 '22 15:10 Angelixus

To work around this, run 'Interrogate' with the sub tab set to img2img instead of Inpainting. The resulted prompt will carry over to Inpainting

zeptofine avatar Oct 04 '22 17:10 zeptofine

To work around this, run 'Interrogate' with the sub tab set to img2img instead of Inpainting. The resulted prompt will carry over to Inpainting

did try all tabs getting the same error as OP on every tab. is there a solution for M1?

NeoTrace82 avatar Oct 16 '22 11:10 NeoTrace82

Screenshot 2022-10-24 042742

samuelcarothers avatar Oct 23 '22 22:10 samuelcarothers

i have same problem and there is no why i can interrogate always same error

farid333 avatar Nov 20 '22 12:11 farid333

same as me,is no fixed

kkiqq22 avatar Dec 25 '22 05:12 kkiqq22

i got a same issue:

Error interrogating Traceback (most recent call last): File "/Users/huangrui/stable-diffusion-webui/modules/interrogate.py", line 196, in interrogate self.load() File "/Users/huangrui/stable-diffusion-webui/modules/interrogate.py", line 123, in load self.blip_model = self.load_blip_model() File "/Users/huangrui/stable-diffusion-webui/modules/interrogate.py", line 103, in load_blip_model blip_model = models.blip.blip_decoder(pretrained=files[0], image_size=blip_image_eval_size, vit='base', med_config=os.path.join(paths.paths["BLIP"], "configs", "med_config.json")) IndexError: list index out of range

tychoon avatar May 22 '23 04:05 tychoon