Repository: stable-diffusion-webui
Issue: [Bug]: Preprocess images retrieves AttributeError: 'NoneType' object has no attribute 'get' with BLIP and Deepbooru
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

I can't use BLIP nor deepbooru for captions, I get a AttributeError: 'NoneType' object has no attribute 'get' error.

### Steps to reproduce the problem

1. Go to .Preprocess images
2. Select source directory
3. Select destination directory
4. Activate Use BLIP for caption
5. Activate Use deepbooru por caption
6. Leave everything else by default.
7. Press Preprocess.
8. Check log.

### What should have happened?

I should have complete my preprocessed images with captions and the desired resized resolution.

### Version or Commit where the problem happens

942302bf77

### What Python version are you running on ?

Python 3.10.x

### What platforms do you use to access the UI ?

Windows

### What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

### Cross attention optimization

xformers

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
set COMMANDLINE_ARGS= --autolaunch --opt-sdp-attention --xformers
```


### List of extensions

<html>
<body>
<!--StartFragment-->

Extension | URL | Branch | Version | Date | Update
-- | -- | -- | -- | -- | --
SadTalker | https://github.com/OpenTalker/SadTalker.git | main | bd5b64af | Sun Aug 6 04:17:40 2023 | unknown
a1111-sd-webui-tagcomplete | https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git | main | b937e853 | Tue Aug 8 17:23:13 2023 | unknown
clip-interrogator-ext | https://github.com/pharmapsychotic/clip-interrogator-ext.git | main | c0bf9005 | Tue Jun 27 19:06:31 2023 | unknown
sd-dynamic-prompts | https://github.com/adieyal/sd-dynamic-prompts.git | main | e53332eb | Thu Aug 3 14:11:19 2023 | unknown
sd-extension-system-info | https://github.com/vladmandic/sd-extension-system-info.git | main | 19d190e7 | Fri Aug 4 21:33:32 2023 | unknown
sd-webui-additional-networks | https://github.com/kohya-ss/sd-webui-additional-networks.git | main | e9f3d622 | Tue May 23 12:31:15 2023 | unknown
sd-webui-controlnet | https://github.com/Mikubill/sd-webui-controlnet.git | main | 4fa91904 | Wed Aug 9 04:21:18 2023 | unknown
sd_dreambooth_extension | https://github.com/d8ahazard/sd_dreambooth_extension.git | main | c2a5617c | Sat Jul 8 13:35:47 2023 | unknown
stable-diffusion-webui-images-browser | https://github.com/AlUlkesh/stable-diffusion-webui-images-browser.git | main | a3aeb93f | Mon Jul 31 20:04:41 2023 | unknown
stable-diffusion-webui-rembg | https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git | master | 3d9eedbb | Sun Jun 4 13:35:24 2023 | unknown
stable-diffusion-webui-state | https://github.com/ilian6806/stable-diffusion-webui-state.git | main | f2bb3809 | Thu Jul 20 06:12:49 2023 | unknown

### Console logs

```Shell
*** Error verifying pickled file from D:\sd original\sd latest\models\torch_deepdanbooru\model-resnet_custom_v3.pt
*** -----> !!!! 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 "D:\sd original\sd latest\modules\safe.py", line 83, in check_pt
        with zipfile.ZipFile(filename) as z:
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1267, in __init__
        self._RealGetContents()
      File "C:\Users\XXX\AppData\Local\Programs\Python\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:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1245, in load_persid
        pid = self.readline()[:-1].decode("ascii")
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 63: ordinal not in range(128)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\sd original\sd latest\modules\safe.py", line 137, in load_with_extra
        check_pt(filename, extra_handler)
      File "D:\sd original\sd latest\modules\safe.py", line 104, in check_pt
        unpickler.load()
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1213, in load
        dispatch[key[0]](self)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1247, in load_persid
        raise UnpicklingError(
    _pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings

---
*** Error completing request
*** Arguments: ('task(q7ihh0m9m7vhi7y)', 'C:\\Users\\XXX\\Desktop\\training\\XXX-20230813T135242Z-001\\training\\image', 'C:\\Users\\XXX\\Desktop\\training\\XXX-20230813T135242Z-001\\training\\512pre', 512, 512, 'ignore', False, False, False, True, True, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1) {}
    Traceback (most recent call last):
      File "D:\sd original\sd latest\modules\call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "D:\sd original\sd latest\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "D:\sd original\sd latest\modules\textual_inversion\ui.py", line 19, in preprocess
        modules.textual_inversion.preprocess.preprocess(*args)
      File "D:\sd original\sd latest\modules\textual_inversion\preprocess.py", line 16, in preprocess
        deepbooru.model.start()
      File "D:\sd original\sd latest\modules\deepbooru.py", line 34, in start
        self.load()
      File "D:\sd original\sd latest\modules\deepbooru.py", line 28, in load
        self.model.load_state_dict(torch.load(files[0], map_location="cpu"))
      File "D:\sd original\sd latest\modules\deepbooru_model.py", line 675, in load_state_dict
        self.tags = state_dict.get('tags', [])
    AttributeError: 'NoneType' object has no attribute 'get'

---
```


### Additional information

_No response_