DominikDoom / a1111-sd-webui-tagcomplete

Booru style tag autocompletion for AUTOMATIC1111's Stable Diffusion web UI
MIT License
2.49k stars 304 forks source link

'get_embeddings' issue with symbolic paths (I think) #291

Open silveroxides opened 6 days ago

silveroxides commented 6 days ago

SO I keep getting this issue. This is the only extension I have that causes issues with my symbolic links I have within my models and embeddings directories. Is this because of the extension using sys module rather than the webui internal paths module?

*** Error executing callback model_loaded_callback for C:\Stable_Diffusion\stable-diffusion-webui\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py
    Traceback (most recent call last):
      File "C:\Stable_Diffusion\stable-diffusion-webui\modules\script_callbacks.py", line 273, in model_loaded_callback
        c.callback(sd_model)
      File "C:\Stable_Diffusion\stable-diffusion-webui\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py", line 221, in get_embeddings
        emb_unknown.append((Path(emb.filename), Path(emb.filename).relative_to(EMB_PATH).as_posix(), ""))
      File "C:\Program Files\Python310\lib\pathlib.py", line 818, in relative_to
        raise ValueError("{!r} is not in the subpath of {!r}"
    ValueError: '.' is not in the subpath of 'C:\\Stable_Diffusion\\stable-diffusion-webui\\embeddings' OR one path is relative and the other is absolute.
DominikDoom commented 6 days ago

Symlinks should not be a problem, I use them myself to share embeddings between different SD frontends. EMB_PATH is specified like this:

EMB_PATH = Path(shared.cmd_opts.embeddings_dir).absolute()

and shared.cmd_opts obviously comes directly from the webui, either a custom value or the default.

From this part of the error message:

ValueError: '.' is not in the subpath of 'C:\\Stable_Diffusion\\stable-diffusion-webui\\embeddings' OR one path is relative and the other is absolute.

It seems more like a filename issue? emb.filename shouldn't just be '.' at that point, normally the webui would provide an absolute path there. Also, it gets appended to the emb_unknown dictionary, meaning the embedding type itself wasn't detected either. Maybe there's a corrupt file in your embedding folder or something like that?