[GH-ISSUE #242] The extension errors every time a checkpoint or VAE is loaded (SD.Next) #174

Closed
opened 2026-10-30 21:20:29 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @mart-hill on GitHub (Sep 25, 2023).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/242

Hi!
I noticed, that for some time, with recent update of the extension, there's an error every time I load a new checkpoint or VAE (the loading of those at startup is fine):

23:03:17-689824 ERROR    executing callback: X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py
                         model_loaded_callback: TypeError
╭─────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────╮
│ X:\AI\automatic\modules\script_callbacks.py:151 in model_loaded_callback                                                                 │
│                                                                                                                                          │
│   150 │   │   │   t0 = time.time()                                                                                                       │
│ ❱ 151 │   │   │   c.callback(sd_model)                                                                                                   │
│   152 │   │   │   timer(t0, c.script, 'model_loaded')                                                                                    │
│                                                                                                                                          │
│ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in get_embeddings                           │
│                                                                                                                                          │
│   183 │   │   elif (emb_b_shape == V2_SHAPE):                                                                                            │
│ ❱ 184 │   │   │   emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()]                                                 │
│   185                                                                                                                                    │
│                                                                                                                                          │
│ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in <listcomp>                               │
│                                                                                                                                          │
│   183 │   │   elif (emb_b_shape == V2_SHAPE):                                                                                            │
│ ❱ 184 │   │   │   emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()]                                                 │
│   185                                                                                                                                    │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:960 in __new__                                                       │
│                                                                                                                                          │
│    959 │   │   │   cls = WindowsPath if os.name == 'nt' else PosixPath                                                                   │
│ ❱  960 │   │   self = cls._from_parts(args)                                                                                              │
│    961 │   │   if not self._flavour.is_supported:                                                                                        │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:594 in _from_parts                                                   │
│                                                                                                                                          │
│    593 │   │   self = object.__new__(cls)                                                                                                │
│ ❱  594 │   │   drv, root, parts = self._parse_args(args)                                                                                 │
│    595 │   │   self._drv = drv                                                                                                           │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:578 in _parse_args                                                   │
│                                                                                                                                          │
│    577 │   │   │   else:                                                                                                                 │
│ ❱  578 │   │   │   │   a = os.fspath(a)                                                                                                  │
│    579 │   │   │   │   if isinstance(a, str):                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: expected str, bytes or os.PathLike object, not NoneType
23:03:18-042325 INFO     Model loaded in 39.20s { load=18.35s create=0.60s apply=0.68s vae=0.53s move=1.32s embeddings=17.29s
                         callbacks=0.38s }
23:03:18-635823 INFO     Model load finished: {'ram': {'used': 11.72, 'total': 63.68}, 'gpu': {'used': 3.92, 'total': 24.0}, 'retries': 0,
                         'oom': 0} cached=0
Loading weights: X:\AI\automatic\models\Stable-diffusion\boymix13.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.6/7.6 GB 0:00:00
23:04:30-433824 INFO     Torch override VAE dtype: no-half set
23:04:30-435324 INFO     Setting Torch parameters: device=cuda dtype=torch.float16 vae=torch.float32 unet=torch.float16
                         context=inference_mode fp16=True bf16=False
23:04:31-021323 INFO     LDM: LatentDiffusion: Running in eps-prediction mode
23:04:31-023324 INFO     LDM: DiffusionWrapper has 859.52 M params.
Loading weights: models\VAE\difconsistencyRAWVAE_v1LOW.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 334.6/334.6 MB 0:00:00
23:04:32-943824 INFO     Cross-attention: optimization=Scaled-Dot-Product options=[]
23:04:50-309825 ERROR    executing callback: X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py
                         model_loaded_callback: TypeError
╭─────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────╮
│ X:\AI\automatic\modules\script_callbacks.py:151 in model_loaded_callback                                                                 │
│                                                                                                                                          │
│   150 │   │   │   t0 = time.time()                                                                                                       │
│ ❱ 151 │   │   │   c.callback(sd_model)                                                                                                   │
│   152 │   │   │   timer(t0, c.script, 'model_loaded')                                                                                    │
│                                                                                                                                          │
│ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in get_embeddings                           │
│                                                                                                                                          │
│   183 │   │   elif (emb_b_shape == V2_SHAPE):                                                                                            │
│ ❱ 184 │   │   │   emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()]                                                 │
│   185                                                                                                                                    │
│                                                                                                                                          │
│ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in <listcomp>                               │
│                                                                                                                                          │
│   183 │   │   elif (emb_b_shape == V2_SHAPE):                                                                                            │
│ ❱ 184 │   │   │   emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()]                                                 │
│   185                                                                                                                                    │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:960 in __new__                                                       │
│                                                                                                                                          │
│    959 │   │   │   cls = WindowsPath if os.name == 'nt' else PosixPath                                                                   │
│ ❱  960 │   │   self = cls._from_parts(args)                                                                                              │
│    961 │   │   if not self._flavour.is_supported:                                                                                        │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:594 in _from_parts                                                   │
│                                                                                                                                          │
│    593 │   │   self = object.__new__(cls)                                                                                                │
│ ❱  594 │   │   drv, root, parts = self._parse_args(args)                                                                                 │
│    595 │   │   self._drv = drv                                                                                                           │
│                                                                                                                                          │
│ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:578 in _parse_args                                                   │
│                                                                                                                                          │
│    577 │   │   │   else:                                                                                                                 │
│ ❱  578 │   │   │   │   a = os.fspath(a)                                                                                                  │
│    579 │   │   │   │   if isinstance(a, str):                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: expected str, bytes or os.PathLike object, not NoneType

There's also a bug with embeddings not being listed anymore, despite the option being set at default for them. The embeddings I use are in the symlinked folder.
It happens on SD.Next UI with 89ba8e3c commit.

Originally created by @mart-hill on GitHub (Sep 25, 2023). Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/242 Hi! I noticed, that for some time, with recent update of the extension, there's an error every time I load a new checkpoint or VAE (the loading of those at startup is fine): ``` 23:03:17-689824 ERROR executing callback: X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py model_loaded_callback: TypeError ╭─────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────╮ │ X:\AI\automatic\modules\script_callbacks.py:151 in model_loaded_callback │ │ │ │ 150 │ │ │ t0 = time.time() │ │ ❱ 151 │ │ │ c.callback(sd_model) │ │ 152 │ │ │ timer(t0, c.script, 'model_loaded') │ │ │ │ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in get_embeddings │ │ │ │ 183 │ │ elif (emb_b_shape == V2_SHAPE): │ │ ❱ 184 │ │ │ emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()] │ │ 185 │ │ │ │ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in <listcomp> │ │ │ │ 183 │ │ elif (emb_b_shape == V2_SHAPE): │ │ ❱ 184 │ │ │ emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()] │ │ 185 │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:960 in __new__ │ │ │ │ 959 │ │ │ cls = WindowsPath if os.name == 'nt' else PosixPath │ │ ❱ 960 │ │ self = cls._from_parts(args) │ │ 961 │ │ if not self._flavour.is_supported: │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:594 in _from_parts │ │ │ │ 593 │ │ self = object.__new__(cls) │ │ ❱ 594 │ │ drv, root, parts = self._parse_args(args) │ │ 595 │ │ self._drv = drv │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:578 in _parse_args │ │ │ │ 577 │ │ │ else: │ │ ❱ 578 │ │ │ │ a = os.fspath(a) │ │ 579 │ │ │ │ if isinstance(a, str): │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: expected str, bytes or os.PathLike object, not NoneType 23:03:18-042325 INFO Model loaded in 39.20s { load=18.35s create=0.60s apply=0.68s vae=0.53s move=1.32s embeddings=17.29s callbacks=0.38s } 23:03:18-635823 INFO Model load finished: {'ram': {'used': 11.72, 'total': 63.68}, 'gpu': {'used': 3.92, 'total': 24.0}, 'retries': 0, 'oom': 0} cached=0 Loading weights: X:\AI\automatic\models\Stable-diffusion\boymix13.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.6/7.6 GB 0:00:00 23:04:30-433824 INFO Torch override VAE dtype: no-half set 23:04:30-435324 INFO Setting Torch parameters: device=cuda dtype=torch.float16 vae=torch.float32 unet=torch.float16 context=inference_mode fp16=True bf16=False 23:04:31-021323 INFO LDM: LatentDiffusion: Running in eps-prediction mode 23:04:31-023324 INFO LDM: DiffusionWrapper has 859.52 M params. Loading weights: models\VAE\difconsistencyRAWVAE_v1LOW.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 334.6/334.6 MB 0:00:00 23:04:32-943824 INFO Cross-attention: optimization=Scaled-Dot-Product options=[] 23:04:50-309825 ERROR executing callback: X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py model_loaded_callback: TypeError ╭─────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────╮ │ X:\AI\automatic\modules\script_callbacks.py:151 in model_loaded_callback │ │ │ │ 150 │ │ │ t0 = time.time() │ │ ❱ 151 │ │ │ c.callback(sd_model) │ │ 152 │ │ │ timer(t0, c.script, 'model_loaded') │ │ │ │ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in get_embeddings │ │ │ │ 183 │ │ elif (emb_b_shape == V2_SHAPE): │ │ ❱ 184 │ │ │ emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()] │ │ 185 │ │ │ │ X:\AI\automatic\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py:184 in <listcomp> │ │ │ │ 183 │ │ elif (emb_b_shape == V2_SHAPE): │ │ ❱ 184 │ │ │ emb_v2 = [(Path(v.filename), k, "v2") for (k,v) in emb_type_b.items()] │ │ 185 │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:960 in __new__ │ │ │ │ 959 │ │ │ cls = WindowsPath if os.name == 'nt' else PosixPath │ │ ❱ 960 │ │ self = cls._from_parts(args) │ │ 961 │ │ if not self._flavour.is_supported: │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:594 in _from_parts │ │ │ │ 593 │ │ self = object.__new__(cls) │ │ ❱ 594 │ │ drv, root, parts = self._parse_args(args) │ │ 595 │ │ self._drv = drv │ │ │ │ C:\Users\user\AppData\Local\Programs\Python\Python310\lib\pathlib.py:578 in _parse_args │ │ │ │ 577 │ │ │ else: │ │ ❱ 578 │ │ │ │ a = os.fspath(a) │ │ 579 │ │ │ │ if isinstance(a, str): │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: expected str, bytes or os.PathLike object, not NoneType ``` ~There's also a bug with embeddings not being listed anymore, despite the option being set at default for them. The embeddings I use are in the symlinked folder.~ It happens on SD.Next UI with 89ba8e3c commit.
Author
Owner

@DominikDoom commented on GitHub (Sep 26, 2023):

After being stuck for a bit, I think that the issue is SD.Next not supporting SDXL embeddings properly, possibly as a side effect of SDXL only working with diffusers there. Do you maybe have any lying around?

From what I've seen in the SD.Next code, they get detected as diffusers concepts, but since the data format is wrong they get skipped.

The issue here is that while in auto1111 they are just ignored but still registered properly, in SD.Next the function exits prematurely, before other info about the skipped embedding like filepaths was added. This is a bug / side effect in SD.Next.

When switching models, tag autocomplete looks up the embeddings to determine their type (sdv1/sdv2, with sdxl being detected as the latter for now). The error then happens when trying to look up these skipped sdxl embeddings, since they have been registered as skipped but are missing filepath and other info, which a1111 on the other hand keeps intact.

I have added a safety check for missing paths on my side, so the error after a model switch should be fixed now. It will also hide those embeddings from autocompletion. In SD.Next it shouldn't be too much of an issue since they seem unsupported anyway.
The root cause of the behavioral difference / bug in SD.Next is still there, but I imagine it will be fixed when they add sdxl support to the original backend instead of just diffusers.

<!-- gh-comment-id:1735080351 --> @DominikDoom commented on GitHub (Sep 26, 2023): After being stuck for a bit, I think that the issue is SD.Next not supporting SDXL embeddings properly, possibly as a side effect of SDXL only working with diffusers there. Do you maybe have any lying around? From what I've seen in the SD.Next code, they get detected as diffusers concepts, but since the data format is wrong they get skipped. The issue here is that while in auto1111 they are just ignored but still registered properly, in SD.Next the function exits prematurely, before other info about the skipped embedding like filepaths was added. This is a bug / side effect in SD.Next. When switching models, tag autocomplete looks up the embeddings to determine their type (sdv1/sdv2, with sdxl being detected as the latter for now). The error then happens when trying to look up these skipped sdxl embeddings, since they have been registered as skipped but are missing filepath and other info, which a1111 on the other hand keeps intact. I have added a safety check for missing paths on my side, so the error after a model switch should be fixed now. It will also hide those embeddings from autocompletion. In SD.Next it shouldn't be too much of an issue since they seem unsupported anyway. The root cause of the behavioral difference / bug in SD.Next is still there, but I imagine it will be fixed when they add sdxl support to the original backend instead of just diffusers.
Author
Owner

@mart-hill commented on GitHub (Sep 26, 2023):

Thank you for quick fix!
The only XL embeddings I have are those 'negatives':
obraz

Could they be the cause?

<!-- gh-comment-id:1735477109 --> @mart-hill commented on GitHub (Sep 26, 2023): Thank you for quick fix! The only XL embeddings I have are those 'negatives': ![obraz](https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/assets/55754730/7f3af8bd-e273-426d-ae92-11e020a0942d) Could they be the cause?
Author
Owner

@DominikDoom commented on GitHub (Sep 26, 2023):

I think these are the same I noticed the problem with, they're from CounterfeitXL, right?
I found an issue on the SD.Next repo that had the same problem, so I mentioned it there. As of now, vlad has already fixed it in the dev branch in response, so it should soon be properly resolved.

It seems specifically related to loading these sdxl embeddings on the original backend (where SD.Next doesn't support sdxl models yet) instead of the diffusers one, which caused the original bug/oversight.

Just out of interest since I don't have one downloaded right now:
In case you have a diffusers XL model you use with SD.Next, do these embeddings get correctly loaded there?
Would be interesting to know if they are incompatible with diffusers or were just not properly skipped on the original backend.

<!-- gh-comment-id:1735502812 --> @DominikDoom commented on GitHub (Sep 26, 2023): I think these are the same I noticed the problem with, they're from CounterfeitXL, right? I found an issue on the SD.Next repo that had the same problem, so I mentioned it there. As of now, vlad has already fixed it in the dev branch in response, so it should soon be properly resolved. It seems specifically related to loading these sdxl embeddings on the original backend (where SD.Next doesn't support sdxl models yet) instead of the diffusers one, which caused the original bug/oversight. Just out of interest since I don't have one downloaded right now: In case you have a diffusers XL model you use with SD.Next, do these embeddings get correctly loaded there? Would be interesting to know if they are incompatible with diffusers or were just not properly skipped on the original backend.
Author
Owner

@mart-hill commented on GitHub (Sep 26, 2023):

I noticed that in Vlad's dev branch as well, can't wait to get original backend implemented for SDXL. 🙂

For the diffusers backend+SDXL, I have trouble running it at all (and since it's still fresh, I'm patiently waiting for fully fledged SDXL support), so I didn't test it much, yet, and I'm using last 'main' branch of the SD.Next, before Vlad started implementing big changes into 'dev' branch and stated, that it's best to go with fresh git pull because of these changes. 🙂

<!-- gh-comment-id:1735684662 --> @mart-hill commented on GitHub (Sep 26, 2023): I noticed that in Vlad's dev branch as well, can't wait to get original backend implemented for SDXL. 🙂 For the diffusers backend+SDXL, I have trouble running it at all (and since it's still fresh, I'm patiently waiting for fully fledged SDXL support), so I didn't test it much, yet, and I'm using last 'main' branch of the SD.Next, before Vlad started implementing big changes into 'dev' branch and stated, that it's best to go with fresh `git pull` because of these changes. 🙂
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
DominikDoom/a1111-sd-webui-tagcomplete#174
No description provided.