Problem with controlnet(sd-controlnet-canny)

Dmitr: <p>Hello. I have another problem, now it’s related to controlnet.</p>
<p>I have next problems:</p>
<p>Traceback (most recent call last):<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_http.py”, line 406, in hf_raise_for_status<br>
response.raise_for_status()<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\requests\models.py”, line 1024, in raise_for_status<br>
raise HTTPError(http_error_msg, response=self)<br>
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: <code>[Preformatted text](https://huggingface.co/None/resolve/main/config.json)</code></p>
<p>The above exception was the direct cause of the following exception:</p>
<p>Traceback (most recent call last):<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\diffusers\configuration_utils.py”, line 379, in load_config<br>
config_file = hf_hub_download(<br>
^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_validators.py”, line 114, in _inner_fn<br>
return fn(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 860, in hf_hub_download<br>
return _hf_hub_download_to_cache_dir(<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 967, in _hf_hub_download_to_cache_dir<br>
_raise_on_head_call_error(head_call_error, force_download, local_files_only)<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 1482, in _raise_on_head_call_error<br>
raise head_call_error<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 1374, in _get_metadata_or_catch_error<br>
metadata = get_hf_file_metadata(<br>
^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_validators.py”, line 114, in _inner_fn<br>
return fn(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 1294, in get_hf_file_metadata<br>
r = _request_wrapper(<br>
^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 278, in _request_wrapper<br>
response = _request_wrapper(<br>
^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\file_download.py”, line 302, in _request_wrapper<br>
hf_raise_for_status(response)<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_http.py”, line 454, in hf_raise_for_status<br>
raise _format(RepositoryNotFoundError, message, response) from e<br>
huggingface_hub.errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-67b37cb3-37fe29d90fe559b83ae5f1b7;2c044edd-b4d0-4bc8-8164-c8714e6ddbed)</p>
<p>Repository Not Found for url: <a href="https://huggingface.co/None/resolve/main/config.json" rel="noopener nofollow ugc">https://huggingface.co/None/resolve/main/config.json</a>.<br>
Please make sure you specified the correct <code>repo_id</code> and <code>repo_type</code>.<br>
If you are trying to access a private or gated repo, make sure you are authenticated.</p>
<p>During handling of the above exception, another exception occurred:</p>
<p>Traceback (most recent call last):<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\style_change.py”, line 15, in<br>
controlnet = ControlNetModel.from_pretrained(<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_validators.py”, line 114, in _inner_fn<br>
return fn(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\diffusers\models\modeling_utils.py”, line 687, in from_pretrained<br>
config, unused_kwargs, commit_hash = cls.load_config(<br>
^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\huggingface_hub\utils_validators.py”, line 114, in _inner_fn<br>
return fn(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^<br>
File “C:\Users\dovsy\Documents\pythonProject\stable_diffusion\venv\Lib\site-packages\diffusers\configuration_utils.py”, line 394, in load_config<br>
raise EnvironmentError(<br>
OSError: None is not a local folder and is not a valid model identifier listed on ‘<a href="https://huggingface.co/models" class="inline-onebox" rel="noopener nofollow ugc">Models - Hugging Face</a>’<br>
If this is a private repository, make sure to pass a token having permission to this repo with <code>token</code> or log in with <code>huggingface-cli login</code>.</p>
<p>My code:</p>
<p>import torch<br>
from controlnet_aux import CannyDetector<br>
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel<br>
from diffusers.utils import load_image, make_image_grid<br>
import os</p>
<p>MMIX_MODEL_PATH = os.getenv(‘MMIX_MODEL_PATH’)<br>
IP_ADAPTER_PATH = os.getenv(‘IP_ADAPTER’)<br>
CANNY_MODEL_PATH=os.getenv(‘CANNY_MODEL’)</p>
<p>img1 = ‘C:\Users\dovsy\Downloads\image-4.png’<br>
img2 = ‘C:\Users\dovsy\Downloads\image-3.png’</p>
<p>controlnet = ControlNetModel.from_pretrained(<br>
CANNY_MODEL_PATH,<br>
torch_dtype=torch.float16<br>
#varient=“fp16”<br>
)</p>
<p>pipe = StableDiffusionControlNetPipeline.from_pretrained(<br>
MMIX_MODEL_PATH,<br>
controlnet=controlnet,<br>
torch_dtype=torch.float16)</p>
<p>pipe.load_ip_adapter(<br>
IP_ADAPTER_PATH+‘//models//ip-adapter_sd15.bin’,<br>
#subfolder=“//models”,<br>
#weight_name=“ip-adapter_sd15.bin”<br>
)</p>
<p>ip_adap_img = load_image(img2)<br>
img = load_image(img1).resize((768, 768))</p>
<p>canny = CannyDetector()<br>
canny_img = canny(img, detect_resolution=512, image_resolution=768)</p>
<p>prompt = “”“(photorealistic:1.2), raw, masterpiece, high quality, 8k, girl wearing hoodie, headphones, hands in pocket”“”<br>
negative_prompt = “low quality, ugly, mutated”</p>
<p>pipe.set_ip_adapter_scale(0.5)</p>
<p>images = pipe(prompt = prompt,<br>
negative_prompt = negative_prompt,<br>
height = 768,<br>
width = 768,<br>
ip_adapter_image = ip_adap_img,<br>
image = canny_img,<br>
guidance_scale = 6,<br>
controlnet_conditioning_scale = 0.7,<br>
num_inference_steps = 20<br>
).images[0]</p>
<p>Can anyone help me?</p>