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]: AttributeError: 'Namespace' object has no attribute 'controlnet_dir' #292

Closed RedFoxNightfox closed 1 month ago

RedFoxNightfox commented 2 months ago

Describe the bug.

AttributeError: 'Namespace' object has no attribute 'controlnet_dir' error when trying to search using extension

Has been happening ever since I ran an update to all extensions (including this one) and main program to latest version.

Steps to reproduce the problem.

  1. Go to browser tab
  2. Press Search icon
  3. ...
  4. Error

Expected behavior

not give error

System info

Console logs

Traceback (most recent call last):
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "M:\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "M:\Stable-Diffusion\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 388, in initial_model_page
    HTML = model_list_html(gl.json_data)
  File "M:\Stable-Diffusion\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 185, in model_list_html
    model_folder = os.path.join(contenttype_folder(item['type'], item['description']))
  File "M:\Stable-Diffusion\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 93, in contenttype_folder
    if cmd_opts.controlnet_dir and not custom_folder:
AttributeError: 'Namespace' object has no attribute 'controlnet_dir'

Additional information

No response

silveroxides commented 2 months ago

In your webui-user.bat add this to your commandline arguments followed by the path to where models are stored (often either in "extensions\sd-webui-controlnet\models" or "models\ControlNet" from webui root folder (add the drive and such parts) as a temporary workaround. Can't guarantee it works though but worth a try. --controlnet-dir

RedFoxNightfox commented 2 months ago

modified the bat command line as follows:

set COMMANDLINE_ARGS=--autolaunch --update-check --xformers --controlnet-dir M:\Stable-Diffusion\stable-diffusion-webui\models

doing that caused this:

Launching Web UI with arguments: --autolaunch --update-check --xformers --controlnet-dir M:Stable-Diffusionstable-diffusion-webuimodels
usage: launch.py [-h] [--update-all-extensions] [--skip-python-version-check]
                 [--skip-torch-cuda-test] [--reinstall-xformers] [--reinstall-torch]
                 [--update-check] [--test-server] [--log-startup] [--skip-prepare-environment]
                 [--skip-install] [--dump-sysinfo] [--loglevel LOGLEVEL]
                 [--do-not-download-clip] [--data-dir DATA_DIR] [--config CONFIG]
                 [--ckpt CKPT] [--ckpt-dir CKPT_DIR] [--vae-dir VAE_DIR]
                 [--gfpgan-dir GFPGAN_DIR] [--gfpgan-model GFPGAN_MODEL] [--no-half]
                 [--no-half-vae] [--no-progressbar-hiding] [--max-batch-count MAX_BATCH_COUNT]
                 [--embeddings-dir EMBEDDINGS_DIR]
                 [--textual-inversion-templates-dir TEXTUAL_INVERSION_TEMPLATES_DIR]
                 [--hypernetwork-dir HYPERNETWORK_DIR] [--localizations-dir LOCALIZATIONS_DIR]
                 [--allow-code] [--medvram] [--medvram-sdxl] [--lowvram] [--lowram]
                 [--always-batch-cond-uncond] [--unload-gfpgan] [--precision {full,autocast}]
                 [--upcast-sampling] [--share] [--ngrok NGROK] [--ngrok-region NGROK_REGION]
                 [--ngrok-options NGROK_OPTIONS] [--enable-insecure-extension-access]
                 [--codeformer-models-path CODEFORMER_MODELS_PATH]
                 [--gfpgan-models-path GFPGAN_MODELS_PATH]
                 [--esrgan-models-path ESRGAN_MODELS_PATH]
                 [--bsrgan-models-path BSRGAN_MODELS_PATH]
                 [--realesrgan-models-path REALESRGAN_MODELS_PATH]
                 [--dat-models-path DAT_MODELS_PATH] [--clip-models-path CLIP_MODELS_PATH]
                 [--xformers] [--force-enable-xformers] [--xformers-flash-attention]
                 [--deepdanbooru] [--opt-split-attention] [--opt-sub-quad-attention]
                 [--sub-quad-q-chunk-size SUB_QUAD_Q_CHUNK_SIZE]
                 [--sub-quad-kv-chunk-size SUB_QUAD_KV_CHUNK_SIZE]
                 [--sub-quad-chunk-threshold SUB_QUAD_CHUNK_THRESHOLD]
                 [--opt-split-attention-invokeai] [--opt-split-attention-v1]
                 [--opt-sdp-attention] [--opt-sdp-no-mem-attention]
                 [--disable-opt-split-attention] [--disable-nan-check]
                 [--use-cpu USE_CPU [USE_CPU ...]] [--use-ipex]
                 [--disable-model-loading-ram-optimization] [--listen] [--port PORT]
                 [--show-negative-prompt] [--ui-config-file UI_CONFIG_FILE]
                 [--hide-ui-dir-config] [--freeze-settings]
                 [--freeze-settings-in-sections FREEZE_SETTINGS_IN_SECTIONS]
                 [--freeze-specific-settings FREEZE_SPECIFIC_SETTINGS]
                 [--ui-settings-file UI_SETTINGS_FILE] [--gradio-debug]
                 [--gradio-auth GRADIO_AUTH] [--gradio-auth-path GRADIO_AUTH_PATH]
                 [--gradio-img2img-tool GRADIO_IMG2IMG_TOOL]
                 [--gradio-inpaint-tool GRADIO_INPAINT_TOOL]
                 [--gradio-allowed-path GRADIO_ALLOWED_PATH] [--opt-channelslast]
                 [--styles-file STYLES_FILE] [--autolaunch] [--theme THEME]
                 [--use-textbox-seed] [--disable-console-progressbars]
                 [--enable-console-prompts] [--vae-path VAE_PATH] [--disable-safe-unpickle]
                 [--api] [--api-auth API_AUTH] [--api-log] [--nowebui] [--ui-debug-mode]
                 [--device-id DEVICE_ID] [--administrator]
                 [--cors-allow-origins CORS_ALLOW_ORIGINS]
                 [--cors-allow-origins-regex CORS_ALLOW_ORIGINS_REGEX]
                 [--tls-keyfile TLS_KEYFILE] [--tls-certfile TLS_CERTFILE]
                 [--disable-tls-verify] [--server-name SERVER_NAME] [--gradio-queue]
                 [--no-gradio-queue] [--skip-version-check] [--no-hashing]
                 [--no-download-sd-model] [--subpath SUBPATH] [--add-stop-route]
                 [--api-server-stop] [--timeout-keep-alive TIMEOUT_KEEP_ALIVE]
                 [--disable-all-extensions] [--disable-extra-extensions]
                 [--skip-load-model-at-start] [--unix-filenames-sanitization]
                 [--filenames-max-length FILENAMES_MAX_LENGTH] [--no-prompt-history]
                 [--ad-no-huggingface] [--wildcards-dir WILDCARDS_DIR]
                 [--ldsr-models-path LDSR_MODELS_PATH] [--lora-dir LORA_DIR]
                 [--lyco-dir-backcompat LYCO_DIR_BACKCOMPAT]
                 [--scunet-models-path SCUNET_MODELS_PATH]
                 [--swinir-models-path SWINIR_MODELS_PATH]
launch.py: error: unrecognized arguments: --controlnet-dir M:Stable-Diffusionstable-diffusion-webuimodels
Press any key to continue . . .
RedFoxNightfox commented 2 months ago

I should note that the models are stored in the default location, with organized subfolders.

RedFoxNightfox commented 2 months ago

seems it was an API problem?

after several hours it's now working. (I have been getting the error 4 hours before opening the trouble ticket to try and rule out potential API problems....)

RedFoxNightfox commented 2 months ago

Okay, it defiantly is not API.

I just tried to look for updates for my installed models, and got the same error.

If "All" is selected, or "controlnet" then it errors out.

Seems there was a controlnet item on the front page when I was trying before to just search front page in the extension.

I tried to put the default directory in the subfolder section of the settings, but it would not let me, and is now blank, not letting me enter anything in that spot.

image

Acechappers commented 1 month ago

I'm getting the same issue, adding --controlnet-dir to the webui-user.bat as an argument did not work either

BlafKing commented 1 month ago

Thanks for reporting!

Turns out this issue is caused by not having the ControlNet argument available, I've now added a check which first verifies if the option is available, which should circumvent this issue.

Can't currently verify if this has actually fixed the issue so let me know if it has resolved your problem! :)

RedFoxNightfox commented 1 month ago

Issue has been fixed. Thanks.