carson-katri / dream-textures

Stable Diffusion built-in to Blender
GNU General Public License v3.0
7.82k stars 427 forks source link

cannot import name 'ControlNetModel' from 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet' #701

Closed AlexNolasco closed 1 year ago

AlexNolasco commented 1 year ago

Description

Unable to use controlnet depth bin files.

An error occurred while generating. Check the issues tab on GitHub to see if this has been reported before:

ImportError("cannot import name 'ControlNetModel' from 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet' (/home/<user>/.config/blender/3.6/scripts/addons/dream_textures/.python_dependencies/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_controlnet.py)")

Steps to Reproduce

1.- Downloaded controlnet depth bin files 2.- Created a cube, went to edit mode, selected faces 3.- Entered a prompt, selected Use ControlNet under Advanced

Error shows

An error occurred while generating. Check the issues tab on GitHub to see if this has been reported before:

ImportError("cannot import name 'ControlNetModel' from 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet' (/home/<user>/.config/blender/3.6/scripts/addons/dream_textures/.python_dependencies/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_controlnet.py)")

Expected Behavior

Should fill faces with generated image using controlnet

Addon Version

Windows (CUDA)

GPU

NVIDIA

nababuddin commented 1 year ago

The error message you provided suggests that there's an ImportError with the 'ControlNetModel' class in the 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet' module. This could be due to a few reasons, but let's work through some steps to help you resolve it.

Check Dependencies: First, make sure you have all the required dependencies and libraries installed as per the add-on's documentation. Missing dependencies could cause these kinds of issues.

Double-Check File Paths: It's important to verify that the file paths mentioned in the error message are accurate. Make sure that the 'pipeline_stable_diffusion_controlnet.py' file actually exists at the specified location.

Update Everything: Ensure that you're using the latest version of both the add-on and Blender. Sometimes, bugs get fixed in newer releases, so updating might resolve the issue.

Look for Similar Issues: As the error message suggests, head to the add-on's GitHub repository and check the "Issues" tab. Someone might have reported a similar problem before, and there could be a solution or workaround.

Compatibility Check: Ensure that the version of the add-on you're using is compatible with your version of Blender and your system setup (Windows with CUDA and NVIDIA GPU).

Temporary Fix: If you're comfortable digging into the code, you could inspect the import statement that's causing trouble. Sometimes, it could be a minor typo or a misplaced file.

Suprhimp commented 1 year ago

I have same issue like this.

when I tried to run class room render engine example, this error occur.

My environment is linux ubuntu, and nvidia.

I checked the pipeline_stable_diffusion_controlnet.py file with my vs code, but in that files it saids it will be deprecate.

# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is deprecated and will be removed in a future version.
# It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works
from ...utils import deprecate
from ..controlnet.multicontrolnet import MultiControlNetModel  # noqa: F401
from ..controlnet.pipeline_controlnet import StableDiffusionControlNetPipeline  # noqa: F401

deprecate(
    "stable diffusion controlnet",
    "0.22.0",
    "Importing `StableDiffusionControlNetPipeline` or `MultiControlNetModel` from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet is deprecated. Please import `from diffusers import StableDiffusionControlNetPipeline` instead.",
    standard_warn=False,
    stacklevel=3,
)

I think this maybe the reason. Than what should we do?

carson-katri commented 1 year ago

You can try downgrading diffusers to 0.16.x

Suprhimp commented 1 year ago

thanks I changed version that written down in requirements.txt and it works well :)

AlexNolasco commented 1 year ago

Thank you for the suggestions, are blender plugins such as yours running under a specific venv? Or will downgrading affect it globally?

carson-katri commented 1 year ago

@AlexNolasco the dependencies are installed into a folder in the addon. You can change the requirements file in the addon and use the button in Blender to reinstall the dependencies.

AlexNolasco commented 1 year ago

downgrading diffusers to 0.16.x

PepeSchoolLand commented 1 year ago

thanks I changed version that written down in requirements.txt and it works well :)

Hi @Suprhimp! Same problem here in linux. What is the exact procedure to downgrade? sorry for my inexperience :(

Suprhimp commented 1 year ago

Screenshot from 2023-09-08 10-00-34

hi! @PepeSchoolLand

You can find the requirements folder in the project.

I changed whole files in that folder. Change git+https://github.com/huggingface/diffusers@main#egg=diffusers to git+https://github.com/huggingface/diffusers@v0.16.1-patch was worked to me :)

PepeSchoolLand commented 1 year ago

Yay! It works :) Thanks a lot!

xiangweifeng commented 8 months ago

The error message you provided suggests that there's an ImportError with the 'ControlNetModel' class in the 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet' module. This could be due to a few reasons, but let's work through some steps to help you resolve it.

Check Dependencies: First, make sure you have all the required dependencies and libraries installed as per the add-on's documentation. Missing dependencies could cause these kinds of issues.

Double-Check File Paths: It's important to verify that the file paths mentioned in the error message are accurate. Make sure that the 'pipeline_stable_diffusion_controlnet.py' file actually exists at the specified location.

Update Everything: Ensure that you're using the latest version of both the add-on and Blender. Sometimes, bugs get fixed in newer releases, so updating might resolve the issue.

Look for Similar Issues: As the error message suggests, head to the add-on's GitHub repository and check the "Issues" tab. Someone might have reported a similar problem before, and there could be a solution or workaround.

Compatibility Check: Ensure that the version of the add-on you're using is compatible with your version of Blender and your system setup (Windows with CUDA and NVIDIA GPU).

Temporary Fix: If you're comfortable digging into the code, you could inspect the import statement that's causing trouble. Sometimes, it could be a minor typo or a misplaced file.

nothing useful