MMqd / kandinsky-for-automatic1111

Automatic1111 extension adding support for Kandinsky 2.X
GNU Affero General Public License v3.0
100 stars 8 forks source link

"NameError: name 'DiffusionPipeline' is not defined" is still occurring even after a clean install #9

Open RoyHammerlin opened 1 year ago

RoyHammerlin commented 1 year ago

I followed the guide on my usual build with about 20 different extensions installed and got this error even after restarting, so I cloned the repo again on a fresh drive, and only installed this extension and nothing else.

In the console during the extension installation I saw that the correct diffusers version was installed:

Checking diffusers version in requriments.txt Correct diffusers version in requriments.txt diffusers installed with version 0.17.1.

After closing the console, restarting and refreshing the browser, I am still getting the error mentioned in the title of this post.

Logs:

Starting Prior Error completing request Arguments: ('task(vb8e83cndqn0mnb)', 'test', '', [], 20, 19, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 4, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, 128, 4, 0.5, 0.5) {} Traceback (most recent call last): File "F:\stable-diffusion-webui\modules\call_queue.py", line 57, in f res = list(func(*args, **kwargs)) File "F:\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(*args, **kwargs) File "F:\stable-diffusion-webui\modules\txt2img.py", line 54, in txt2img processed = modules.scripts.scripts_txt2img.run(p, *args) File "F:\stable-diffusion-webui\modules\scripts.py", line 441, in run processed = script.run(p, *script_args) File "F:\stable-diffusion-webui\extensions\kandinsky-for-automatic1111\scripts\kandinsky.py", line 236, in run pipe_prior = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16, cache_dir=self.cache_dir) NameError: name 'DiffusionPipeline' is not defined

This is happening with and without memory optimizations.

FlowDownTheRiver commented 1 year ago

I have manually installed after activating the environment with "pip install diffusers==0.17.1" . it fixed the problem. You can edit the requirements.txt and requirements_versions.txt(in the main folder of webui) by putting entry "diffusers==0.17.1" there as well. If you use git pull it can overwrite those files,so be aware of it. @RoyHammerlin

MMqd commented 1 year ago

@FlowDownTheRiver Thanks for pointing out a potential bug with git pull.

@RoyHammerlin Can you send the full console output while installing, and running the extension?

VickyHax commented 1 year ago
venv "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
==============================================================================================================
INCOMPATIBLE PYTHON VERSION

This program is tested with 3.10.6 Python, but you have 3.11.4.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.

You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3106/

Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases

Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
Version: v1.4.0
Commit hash: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8
Installing requirements
Requirement already satisfied: diffusers>=0.17.1 in c:\users\vicky\anaconda3\lib\site-packages (0.17.1)
Requirement already satisfied: filelock in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (3.9.0)
Requirement already satisfied: requests in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (2.24.0)
Requirement already satisfied: regex!=2019.12.17 in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (2022.7.9)
Requirement already satisfied: huggingface-hub>=0.13.2 in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (0.15.1)
Requirement already satisfied: numpy in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (1.23.5)
Requirement already satisfied: importlib-metadata in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (4.11.3)
Requirement already satisfied: Pillow in c:\users\vicky\anaconda3\lib\site-packages (from diffusers>=0.17.1) (9.4.0)
Requirement already satisfied: fsspec in c:\users\vicky\anaconda3\lib\site-packages (from huggingface-hub>=0.13.2->diffusers>=0.17.1) (2022.11.0)
Requirement already satisfied: tqdm>=4.42.1 in c:\users\vicky\anaconda3\lib\site-packages (from huggingface-hub>=0.13.2->diffusers>=0.17.1) (4.64.1)
Requirement already satisfied: packaging>=20.9 in c:\users\vicky\anaconda3\lib\site-packages (from huggingface-hub>=0.13.2->diffusers>=0.17.1) (22.0)
Requirement already satisfied: pyyaml>=5.1 in c:\users\vicky\anaconda3\lib\site-packages (from huggingface-hub>=0.13.2->diffusers>=0.17.1) (6.0)
Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\users\vicky\anaconda3\lib\site-packages (from huggingface-hub>=0.13.2->diffusers>=0.17.1) (4.4.0)
Requirement already satisfied: zipp>=0.5 in c:\users\vicky\anaconda3\lib\site-packages (from importlib-metadata->diffusers>=0.17.1) (3.11.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\vicky\anaconda3\lib\site-packages (from requests->diffusers>=0.17.1) (1.25.11)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\vicky\anaconda3\lib\site-packages (from requests->diffusers>=0.17.1) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\vicky\anaconda3\lib\site-packages (from requests->diffusers>=0.17.1) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in c:\users\vicky\anaconda3\lib\site-packages (from requests->diffusers>=0.17.1) (2.10)
Requirement already satisfied: colorama in c:\users\vicky\anaconda3\lib\site-packages (from tqdm>=4.42.1->huggingface-hub>=0.13.2->diffusers>=0.17.1) (0.4.6)
Checking diffusers version in requriments.txt
Correct diffusers version in requriments.txt
diffusers installed with version 0.17.1.

Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
==============================================================================================
RESTART AUTOMATIC1111 COMPLETELY TO FINISH INSTALLING PACKAGES FOR kandinsky-for-automatic1111
==============================================================================================
Loading weights [6ce0161689] from C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 22.1s (import torch: 5.9s, import gradio: 3.4s, import ldm: 1.8s, other imports: 2.9s, setup codeformer: 0.2s, load scripts: 3.7s, create ui: 2.0s, gradio launch: 2.0s).
Creating model from config: C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Textual inversion embeddings loaded(0):
Model loaded in 15.7s (load weights from disk: 4.2s, create model: 2.7s, apply weights to model: 3.3s, apply half(): 2.8s, move model to device: 2.4s, calculate empty prompt: 0.3s).
preload_extensions_git_metadata for 36 extensions took 15.02s
Starting Prior
*** Error completing request
*** Arguments: ('task(bjahpwn6dxg9bu5)', 'twitter avatar background, beautiful, gorgeous, intricate, hyper detailed, smooth, dynamic volumetric lighting, octane, ray tracing, 8k', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 4, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, 128, 4, 0.5, 0.5) {}
    Traceback (most recent call last):
      File "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 55, in f
        res = list(func(*args, **kwargs))
                   ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 35, in f
        res = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\modules\txt2img.py", line 54, in txt2img
        processed = modules.scripts.scripts_txt2img.run(p, *args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\modules\scripts.py", line 456, in run
        processed = script.run(p, *script_args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Vicky\Code\StableDiffusion\stable-diffusion-webui\extensions\kandinsky-for-automatic1111\scripts\kandinsky.py", line 236, in run
        pipe_prior = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16, cache_dir=self.cache_dir)
                     ^^^^^^^^^^^^^^^^^
    NameError: name 'DiffusionPipeline' is not defined
angrysky56 commented 1 year ago

VickyHax Part of your issue is- This program is tested with 3.10.6 Python, but you have 3.11.4.

I am having the same issue though- Mine is using 3.10.9 which I think it is using automatically now but I may have set that up, not sure.

Traceback (most recent call last): File "D:\automatic1111\modules\call_queue.py", line 58, in f res = list(func(*args, *kwargs)) File "D:\automatic1111\modules\call_queue.py", line 37, in f res = func(args, *kwargs) File "D:\automatic1111\modules\txt2img.py", line 59, in txt2img processed = modules.scripts.scripts_txt2img.run(p, args) File "D:\automatic1111\modules\scripts.py", line 477, in run processed = script.run(p, *script_args) File "D:\automatic1111\extensions\kandinsky-for-automatic1111\scripts\kandinsky.py", line 236, in run pipe_prior = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16, cache_dir=self.cache_dir) NameError: name 'DiffusionPipeline' is not defined

VickyHax commented 1 year ago

VickyHax Part of your issue is- This program is tested with 3.10.6 Python, but you have 3.11.4.

I am having the same issue though- Mine is using 3.10.9 which I think it is using automatically now but I may have set that up, not sure.

Thank you! I'm new to python but with that context I can probably figure it out.

Acephalia commented 1 year ago

Same issue on python: 3.10.9. Tried everything including fresh reinstall and pip install diffusers==0.17.1

   Traceback (most recent call last):
      File "S:\stable-diffusion-webui\modules\call_queue.py", line 55, in f
        res = list(func(*args, **kwargs))
      File "S:\stable-diffusion-webui\modules\call_queue.py", line 35, in f
        res = func(*args, **kwargs)
      File "S:\stable-diffusion-webui\modules\txt2img.py", line 54, in txt2img
        processed = modules.scripts.scripts_txt2img.run(p, *args)
      File "S:\stable-diffusion-webui\modules\scripts.py", line 456, in run
        processed = script.run(p, *script_args)
      File "S:\stable-diffusion-webui\extensions\kandinsky-for-automatic1111\scripts\kandinsky.py", line 236, in run
        pipe_prior = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16, cache_dir=self.cache_dir)
    NameError: name 'DiffusionPipeline' is not defined
anirudhv commented 1 year ago

Anyone figure out a solution to this issue yet?

oleg-chibikov commented 1 year ago

Still having this issue, it says that I have diffusers version 0.17.1 but it doesn't help