Bing-su / adetailer

Auto detecting, masking and inpainting with detection model.
GNU Affero General Public License v3.0
4.2k stars 329 forks source link

[Bug]: Custom Adetailer Models won't get recognised #740

Closed CS1o closed 6 days ago

CS1o commented 6 days ago

Describe the bug

Custom Models for Adetailer won't show up in the Adetailer selection.

Steps to reproduce

Update Adetailer to the latest Version. Download an adetailer compatible model from Civitai and move it into models/adetailer. Restart the Webui (Auto1111 or Forge) and the model wont show up under the Adetailer model dropdown.

Screenshots

grafik grafik

Console logs, from start to end.

Already up to date.
venv "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
WARNING: ZLUDA works best with SD.Next. Please consider migrating to SD.Next.
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.10.1-amd-17-g745b20b7
Commit hash: 745b20b7c69a1fa10ee789b3981484389ac80aef
ROCm: agents=['gfx1100', 'gfx1036']
ROCm: version=6.1, using agent gfx1100
ZLUDA support: experimental
Using ZLUDA in D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\.zluda
Skipping onnxruntime installation.
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\a1111-sd-webui-tagcomplete':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\adetailer':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\multidiffusion-upscaler-for-automatic1111':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-animatediff':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-controlnet':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-cutoff':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-inpaint-background':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-mov2mov':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-reactor':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-regional-prompter':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\stable-diffusion-webui-depthmap-script':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\stable-diffusion-webui-prompt-travel':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\stable-diffusion-webui-rembg':
Already up to date.

Pulled changes for repository in 'D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\stable-diffusion-webui-wildcards':
Already up to date.

no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Launching Web UI with arguments: --use-zluda --skip-ort --update-all-extensions --models-dir 'D:\Programme\AI-Zeug\stable-diffusion-webui-directml\models'
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 24.11.1, num models: 10
ControlNet preprocessor location: D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\annotator\downloads
2024-11-22 16:30:50,248 - ControlNet - INFO - ControlNet v1.1.455
WARNING:dinov2:xFormers not available
WARNING:dinov2:xFormers not available
[ControlNet-Travel] extension Mikubill/sd-webui-controlnet found, ControlNet-Travel loaded :)
Loading weights [eeeb8acd9c] from D:\Programme\AI-Zeug\stable-diffusion-webui-directml\models\Stable-diffusion\SDXL\Pony\novaAnimeXL_v70Happyhalloween.safetensors
Creating model from config: D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\configs\inference\sd_xl_base.yaml
creating model quickly: OSError
Traceback (most recent call last):
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\utils\_http.py", line 406, in hf_raise_for_status
    response.raise_for_status()
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\requests\models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/None/resolve/main/config.json

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\utils\hub.py", line 403, in cached_file
    resolved_file = hf_hub_download(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 862, in hf_hub_download
    return _hf_hub_download_to_cache_dir(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 969, in _hf_hub_download_to_cache_dir
    _raise_on_head_call_error(head_call_error, force_download, local_files_only)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 1484, in _raise_on_head_call_error
    raise head_call_error
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 1376, in _get_metadata_or_catch_error
    metadata = get_hf_file_metadata(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 1296, in get_hf_file_metadata
    r = _request_wrapper(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 277, in _request_wrapper
    response = _request_wrapper(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\file_download.py", line 301, in _request_wrapper
    hf_raise_for_status(response)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\huggingface_hub\utils\_http.py", line 454, in hf_raise_for_status
    raise _format(RepositoryNotFoundError, message, response) from e
huggingface_hub.errors.RepositoryNotFoundError: 401 Client Error. (Request ID: Root=1-6740a3c4-6cf710092a44daf019327b8b;2de649a0-162b-4035-9990-83d393d55537)

Repository Not Found for url: https://huggingface.co/None/resolve/main/config.json.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
Invalid username or password.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\webyo\AppData\Local\Programs\Python\Python310\lib\threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\webyo\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\webyo\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\initialize.py", line 149, in load_model
    shared.sd_model  # noqa: B018
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\shared_items.py", line 190, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\sd_models.py", line 693, in get_sd_model
    load_model()
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\sd_models.py", line 831, in load_model
    sd_model = instantiate_from_config(sd_config.model, state_dict)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\sd_models.py", line 775, in instantiate_from_config
    return constructor(**params)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\sgm\models\diffusion.py", line 61, in __init__
    self.conditioner = instantiate_from_config(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\sgm\util.py", line 175, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\sgm\modules\encoders\modules.py", line 88, in __init__
    embedder = instantiate_from_config(embconfig)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\sgm\util.py", line 175, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\repositories\generative-models\sgm\modules\encoders\modules.py", line 361, in __init__
    self.transformer = CLIPTextModel.from_pretrained(version)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\modules\sd_disable_initialization.py", line 68, in CLIPTextModel_from_pretrained
    res = self.CLIPTextModel_from_pretrained(None, *model_args, config=pretrained_model_name_or_path, state_dict={}, **kwargs)
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\modeling_utils.py", line 3505, in from_pretrained
    resolved_config_file = cached_file(
  File "D:\Programme\AI-Zeug\SD-Zluda-Webui\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\utils\hub.py", line 426, in cached_file
    raise EnvironmentError(
OSError: None is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`

Failed to create model quickly; will retry using slow method.
Loading VAE weights specified in settings: D:\Programme\AI-Zeug\stable-diffusion-webui-directml\models\VAE\sdxl_vae_fp16.safetensors
Applying attention optimization: Doggettx... done.
Model loaded in 15.7s (load weights from disk: 0.3s, create model: 5.5s, apply weights to model: 8.2s, apply half(): 0.1s, load VAE: 0.5s, move model to device: 0.1s, load textual inversion embeddings: 0.2s, calculate empty prompt: 0.6s).
2024-11-22 16:31:09,085 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 55.0s (prepare environment: 37.8s, initialize shared: 0.8s, other imports: 0.7s, load scripts: 5.0s, create ui: 16.4s, gradio launch: 0.3s).

List of installed extensions

grafik

dosubot[bot] commented 6 days ago

@CS1o Hello there! I'm here to help you with any bugs, questions, or anything else you might need. Let's squash those bugs together! 🤖

To address the issue of custom Adetailer models not being recognized, ensure the following:

  1. File Extension: The models should have a .pt file extension, as Adetailer recognizes models with this extension [1].

  2. Directory Structure: Place the models in the models/adetailer directory. Additionally, ensure that any extra model directories are specified correctly in the ad_extra_models_dir option, if used. These directories should be separated by vertical bars (|) [2].

  3. Model Validity: Ensure that the models are valid bbox detection or segment models. Invalid models will not be recognized [1].

  4. Logging and Errors: Check the console logs for any error messages related to model loading. Adetailer provides error messages when it fails to recognize a model, which can help diagnose the issue [2][3].

If these steps do not resolve the issue, consider checking for any updates or changes in the Adetailer repository that might affect model recognition.

To continue talking to Dosu, mention @dosu.

CS1o commented 6 days ago

Fixed.

Turns out when i switched from --ckpt-dir "Path to models/stable-diffusion" --lora-dir "Path to models/lora" etc. to just --models-dir "Path to the overall models Folder" a few days ago, the adetailer models then wont get recognised when they are still in the webuis models/adetailer folder and not in the new Path given by --models-dir. Makes sense as thats how it should work.