BlafKing / sd-civitai-browser-plus

Extension to access CivitAI via WebUI: download, delete, scan for updates, list installed models, assign tags, and boost downloads with multi-threading.
GNU Affero General Public License v3.0
289 stars 44 forks source link

[Bug]: Drives other than C: break #276

Closed ice-fly closed 3 months ago

ice-fly commented 3 months ago

Describe the bug.

Running update tags breaks when path is on D:

Steps to reproduce the problem.

Install on another drive and try to update tags

Expected behavior

Saves tags to any drive path

System info

Console logs

save_path, name = get_save_path_and_name(install_path, file_name, api_response)
  File "D:\Downloads\Installs\sdwebui\webui\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 814, in get_save_path_and_name
    sub_folder = os.path.normpath(os.path.relpath(install_path, gl.main_folder))
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 744, in relpath
    raise ValueError("path is on mount %r, start on mount %r" % (
ValueError: path is on mount 'D:', start on mount 'C:'

Additional information

Used to work

ice-fly commented 3 months ago

Duplicates #271

slaw commented 2 months ago

Duplicate #271 resolution is based on symlinks on windows. I am on windows, but I don't use symlinks to link model folders to Forge or a1111. In the .bat file you can set custom paths in the COMMANDLINE_ARGS. For example, if you have your models on a D drive:

set COMMANDLINE_ARGS=--xformers  --theme dark  ^
 --ckpt-dir 'D:\My Models\Stable-diffusion-models' ^
 --embeddings-dir 'D:\My Models\embeddings' ^
 --hypernetwork-dir 'D:\My Models\hypernetworks' ^
 --vae-dir 'D:\My Models\VAE' ^
 --lora-dir 'D:\My Models\Lora' ^
 --lyco-dir 'D:\My Models\LyCORIS' ^
 --esrgan-models-path 'D:\My Models\ESRGAN'

You can even add a custom path to controlnet models, but you need the controlnet extension installed first or Stable Diffusion throws errors.

 --controlnet-dir 'D:\My Models\ControlNet'

Recently I have encountered the OP's issue when trying to update any of the models. ValueError: path is on mount 'D:', start on mount 'C:'

BlafKing commented 2 months ago

Thanks for letting me know!

It looks I didn't properly set up the command flag for ControlNet as I wasn't aware that it had one when installed, all the other command flags you mentioned should already be taken into account when using the extension.

I'm not sure if adding the command flag compatibility for ControlNet will fix this issue, so I'll definitely look into a different method of fetching the sub-folder which is causing this error. I've made a small hotfix that now adds the ControlNet command flags into the extension