[GH-ISSUE #25] Extension not working since latest update #22

Open
opened 2026-10-31 21:16:11 +00:00 by bsakaguchi · 8 comments
Owner

Originally created by @tarunabhdutta on GitHub (Mar 20, 2023).
Original GitHub issue: https://github.com/pharmapsychotic/clip-interrogator-ext/issues/25

Error verifying new BLIP Large pickled file. Can I download it manually to solve the issue?

HERE IS THE ERROR:

Loading CLIP Interrogator 0.6.0...
Loading caption model blip-large...
Error verifying pickled file from C:\Users\TD FILM STUDIO/.cache\huggingface\hub\models--Salesforce--blip-image-captioning-large\snapshots\44f04d56320e7d169fec18c4b19f7efb9ab83105\pytorch_model.bin:
Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 81, in check_pt
with zipfile.ZipFile(filename) as z:
File "C:\Program Files\Python310\lib\zipfile.py", line 1267, in init
self._RealGetContents()
File "C:\Program Files\Python310\lib\zipfile.py", line 1334, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 135, in load_with_extra
check_pt(filename, extra_handler)
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 102, in check_pt
unpickler.load()
_pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings

-----> !!!! The file is most likely corrupted !!!! <-----
You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.

Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
output = await app.get_blocks().process_api(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 128, in image_to_prompt
load(clip_model_name, caption_model_name)
File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 66, in load
ci = Interrogator(config)
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 70, in init
self.load_caption_model()
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 84, in load_caption_model
caption_model = BlipForConditionalGeneration.from_pretrained(model_path, torch_dtype=self.dtype)
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\transformers\modeling_utils.py", line 2480, in from_pretrained
loaded_state_dict_keys = list(state_dict.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

Originally created by @tarunabhdutta on GitHub (Mar 20, 2023). Original GitHub issue: https://github.com/pharmapsychotic/clip-interrogator-ext/issues/25 Error verifying new BLIP Large pickled file. Can I download it manually to solve the issue? HERE IS THE ERROR: Loading CLIP Interrogator 0.6.0... Loading caption model blip-large... Error verifying pickled file from C:\Users\TD FILM STUDIO/.cache\huggingface\hub\models--Salesforce--blip-image-captioning-large\snapshots\44f04d56320e7d169fec18c4b19f7efb9ab83105\pytorch_model.bin: Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 81, in check_pt with zipfile.ZipFile(filename) as z: File "C:\Program Files\Python310\lib\zipfile.py", line 1267, in __init__ self._RealGetContents() File "C:\Program Files\Python310\lib\zipfile.py", line 1334, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 135, in load_with_extra check_pt(filename, extra_handler) File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 102, in check_pt unpickler.load() _pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings -----> !!!! The file is most likely corrupted !!!! <----- You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you. Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function prediction = await anyio.to_thread.run_sync( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 128, in image_to_prompt load(clip_model_name, caption_model_name) File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 66, in load ci = Interrogator(config) File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 70, in __init__ self.load_caption_model() File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 84, in load_caption_model caption_model = BlipForConditionalGeneration.from_pretrained(model_path, torch_dtype=self.dtype) File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\transformers\modeling_utils.py", line 2480, in from_pretrained loaded_state_dict_keys = list(state_dict.keys()) AttributeError: 'NoneType' object has no attribute 'keys'
Author
Owner

@keenmouse commented on GitHub (Mar 20, 2023):

Is it failing to validate pytorch_model.bin because your virus scanner is removing it as soon as it's downloaded? I think you might be having the same problem being discussed here and here. It may only be happening with Windows Defender.

<!-- gh-comment-id:1476743953 --> @keenmouse commented on GitHub (Mar 20, 2023): Is it failing to validate pytorch_model.bin because your virus scanner is removing it as soon as it's downloaded? I think you might be having the same problem being discussed [here](https://github.com/invoke-ai/InvokeAI/issues/2989) and [here](https://itch.io/post/7509488). It may only be happening with Windows Defender.
Author
Owner

@tripletto commented on GitHub (Mar 20, 2023):

Can confirm, deactivating the Windows Defender real time protection made it work.

<!-- gh-comment-id:1477056649 --> @tripletto commented on GitHub (Mar 20, 2023): Can confirm, deactivating the Windows Defender real time protection made it work.
Author
Owner

@tarunabhdutta commented on GitHub (Mar 21, 2023):

No, windows defender and firewall were already turned off. Moreover turning off all the firewall and all my antivirus did not help. I tried manually downloading the pytorch_model.bin for 'BLIP Large' and put it in the Clip Interrogator folder inside model folder of A1111. That didn't help either.
Loading CLIP Interrogator 0.6.0...
Loading caption model blip-large...
Error verifying pickled file from C:\Users\TD FILM STUDIO/.cache\huggingface\hub\models--Salesforce--blip-image-captioning-large\snapshots\44f04d56320e7d169fec18c4b19f7efb9ab83105\pytorch_model.bin:
Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 81, in check_pt
with zipfile.ZipFile(filename) as z:
File "C:\Program Files\Python310\lib\zipfile.py", line 1267, in init
self._RealGetContents()
File "C:\Program Files\Python310\lib\zipfile.py", line 1334, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 135, in load_with_extra
check_pt(filename, extra_handler)
File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 102, in check_pt
unpickler.load()
_pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings

-----> !!!! The file is most likely corrupted !!!! <-----
You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.

Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
output = await app.get_blocks().process_api(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 128, in image_to_prompt
load(clip_model_name, caption_model_name)
File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 66, in load
ci = Interrogator(config)
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 70, in init
self.load_caption_model()
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 84, in load_caption_model
caption_model = BlipForConditionalGeneration.from_pretrained(model_path, torch_dtype=self.dtype)
File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\transformers\modeling_utils.py", line 2480, in from_pretrained
loaded_state_dict_keys = list(state_dict.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

<!-- gh-comment-id:1477692029 --> @tarunabhdutta commented on GitHub (Mar 21, 2023): No, windows defender and firewall were already turned off. Moreover turning off all the firewall and all my antivirus did not help. I tried manually downloading the pytorch_model.bin for 'BLIP Large' and put it in the Clip Interrogator folder inside model folder of A1111. That didn't help either. Loading CLIP Interrogator 0.6.0... Loading caption model blip-large... Error verifying pickled file from C:\Users\TD FILM STUDIO/.cache\huggingface\hub\models--Salesforce--blip-image-captioning-large\snapshots\44f04d56320e7d169fec18c4b19f7efb9ab83105\pytorch_model.bin: Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 81, in check_pt with zipfile.ZipFile(filename) as z: File "C:\Program Files\Python310\lib\zipfile.py", line 1267, in __init__ self._RealGetContents() File "C:\Program Files\Python310\lib\zipfile.py", line 1334, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 135, in load_with_extra check_pt(filename, extra_handler) File "C:\SD\stable-diffusion-webui-master\modules\safe.py", line 102, in check_pt unpickler.load() _pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings -----> !!!! The file is most likely corrupted !!!! <----- You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you. Traceback (most recent call last): File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function prediction = await anyio.to_thread.run_sync( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 128, in image_to_prompt load(clip_model_name, caption_model_name) File "C:\SD\stable-diffusion-webui-master\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 66, in load ci = Interrogator(config) File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 70, in __init__ self.load_caption_model() File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 84, in load_caption_model caption_model = BlipForConditionalGeneration.from_pretrained(model_path, torch_dtype=self.dtype) File "C:\SD\stable-diffusion-webui-master\venv\lib\site-packages\transformers\modeling_utils.py", line 2480, in from_pretrained loaded_state_dict_keys = list(state_dict.keys()) AttributeError: 'NoneType' object has no attribute 'keys'
Author
Owner

@tripletto commented on GitHub (Mar 21, 2023):

You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.

^^
From your error message. I had this as well and can confirm, that the extension works with this command line argument and the Windows Defender real time protection deactivated – which is pretty messy and even though it says, that it won't help me. :D

<!-- gh-comment-id:1477969044 --> @tripletto commented on GitHub (Mar 21, 2023): > You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you. ^^ From your error message. I had this as well and can confirm, that the extension works with this command line argument and the Windows Defender real time protection deactivated – which is pretty messy and even though it says, that it won't help me. :D
Author
Owner

@keenmouse commented on GitHub (Mar 21, 2023):

Can confirm, deactivating the Windows Defender real time protection made it work.

I wouldn't recommend disabling real time protection altogether. Just add an exception for pytorch_model.bin.

<!-- gh-comment-id:1477997675 --> @keenmouse commented on GitHub (Mar 21, 2023): > Can confirm, deactivating the Windows Defender real time protection made it work. I wouldn't recommend disabling real time protection altogether. Just add an exception for pytorch_model.bin.
Author
Owner

@caj001 commented on GitHub (Mar 22, 2023):

This used to work fine but now I get the following error with starting Automatic1111:

Error loading script: clip_interrogator_ext.py
Traceback (most recent call last):
  File "F:\Automatic1111\modules\scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "F:\Automatic1111\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "F:\Automatic1111\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 10, in <module>
    from clip_interrogator import Config, Interrogator, list_caption_models, list_clip_models
ImportError: cannot import name 'list_caption_models' from 'clip_interrogator' (F:\Automatic1111\venv\lib\site-packages\clip_interrogator\__init__.py)
<!-- gh-comment-id:1480298440 --> @caj001 commented on GitHub (Mar 22, 2023): This used to work fine but now I get the following error with starting Automatic1111: ``` Error loading script: clip_interrogator_ext.py Traceback (most recent call last): File "F:\Automatic1111\modules\scripts.py", line 248, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "F:\Automatic1111\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "F:\Automatic1111\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 10, in <module> from clip_interrogator import Config, Interrogator, list_caption_models, list_clip_models ImportError: cannot import name 'list_caption_models' from 'clip_interrogator' (F:\Automatic1111\venv\lib\site-packages\clip_interrogator\__init__.py) ```
Author
Owner

@pharmapsychotic commented on GitHub (Mar 22, 2023):

@caj001 can you look up further in the output to see if it is failing to install clip_interrogator? It requires version 0.6.0 of clip_interrogator is installed. You can also try installing it manually to see what might be going wrong

F:\Automatic1111> venv\Scripts\activate.bat
(venv) F:\Automatic1111> pip install clip-interrogator==0.6.0
<!-- gh-comment-id:1480302230 --> @pharmapsychotic commented on GitHub (Mar 22, 2023): @caj001 can you look up further in the output to see if it is failing to install clip_interrogator? It requires version 0.6.0 of clip_interrogator is installed. You can also try installing it manually to see what might be going wrong ``` F:\Automatic1111> venv\Scripts\activate.bat (venv) F:\Automatic1111> pip install clip-interrogator==0.6.0 ```
Author
Owner

@caj001 commented on GitHub (Mar 29, 2023):

Hi. I'm still experiencing an error with this. I've installed clip-interrogator v0.6.0 but still, no luck.

Error loading script: clip_interrogator_ext.py
Traceback (most recent call last):
  File "F:\Automatic1111\modules\scripts.py", line 256, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "F:\Automatic1111\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "F:\Automatic1111\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 9, in <module>
    import clip_interrogator
  File "F:\Automatic1111\venv\lib\site-packages\clip_interrogator\__init__.py", line 1, in <module>
    from .clip_interrogator import Config, Interrogator, LabelTable, list_caption_models, list_clip_models, load_list
  File "F:\Automatic1111\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 12, in <module>
    from transformers import AutoProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, Blip2ForConditionalGeneration
ImportError: cannot import name 'BlipForConditionalGeneration' from 'transformers' (F:\Automatic1111\venv\lib\site-packages\transformers\__init__.py)
<!-- gh-comment-id:1487778634 --> @caj001 commented on GitHub (Mar 29, 2023): Hi. I'm still experiencing an error with this. I've installed clip-interrogator v0.6.0 but still, no luck. ``` Error loading script: clip_interrogator_ext.py Traceback (most recent call last): File "F:\Automatic1111\modules\scripts.py", line 256, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "F:\Automatic1111\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "F:\Automatic1111\extensions\clip-interrogator-ext\scripts\clip_interrogator_ext.py", line 9, in <module> import clip_interrogator File "F:\Automatic1111\venv\lib\site-packages\clip_interrogator\__init__.py", line 1, in <module> from .clip_interrogator import Config, Interrogator, LabelTable, list_caption_models, list_clip_models, load_list File "F:\Automatic1111\venv\lib\site-packages\clip_interrogator\clip_interrogator.py", line 12, in <module> from transformers import AutoProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, Blip2ForConditionalGeneration ImportError: cannot import name 'BlipForConditionalGeneration' from 'transformers' (F:\Automatic1111\venv\lib\site-packages\transformers\__init__.py) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pharmapsychotic/clip-interrogator-ext#22
No description provided.