megvii-research / HiDiffusion

[ECCV 2024] HiDiffusion: Increases the resolution and speed of your diffusion model by only adding a single line of code!
Apache License 2.0
666 stars 38 forks source link

Can't detect HiDiffusion package #7

Closed arakinas closed 2 months ago

arakinas commented 2 months ago

I am on Windows, trying to use HiDiffusion. After installing the Pip package, my system is unable to resolve the hidiffusion import, when trying to follow the instructions on the Readme.

Within my IDE:

Import "hidiffusion" could not be resolved

Example from my console:

F:\Localllm\AlternateInference> pip install hidiffusion --no-cache-dir
WARNING: Skipping C:\Users---\anaconda3\Lib\site-packages\torch-2.2.0.dist-info due to invalid metadata entry 'name' Collecting hidiffusion Downloading hidiffusion-0.1.5-py3-none-any.whl.metadata (15 kB) Downloading hidiffusion-0.1.5-py3-none-any.whl (32 kB) WARNING: Skipping C:\Users---\anaconda3\Lib\site-packages\torch-2.2.0.dist-info due to invalid metadata entry 'name' Installing collected packages: hidiffusion Successfully installed hidiffusion-0.1.5 PS F:\Localllm\AlternateInference> & C:/Users/--/AppData/Local/Programs/Python/Python310/python.exe f:/Localllm/AlternateInference/inference_engine/image_inference.py Traceback (most recent call last): File "f:\Localllm\AlternateInference\inference_engine\image_inference.py", line 1, in from hidiffusion import apply_hidiffusion, remove_hidiffusion ModuleNotFoundError: No module named 'hidiffusion'

I have attempted to use pyenv, and conda environments, as well as setting the python version to 3.8, as opposed to my system default of 3.10. Here we have the end of the install from a requirements.txt I put up from the requirements listed on the instructions. I have marked where hidiffusion is among these items. I have attempted to restart the IDE, the terminal, and my machine, and haven't seen a change with my system being unable to detect hidifussion, despite being installed via pip:

Installing collected packages: mpmath, hidiffusion, zipp, urllib3, typing-extensions, sympy, safetensors, regex, pyyaml, psutil, Pillow, packaging, numpy, networkx, MarkupSafe, idna, fsspec, filelock, colorama, charset-normalizer, certifi, tqdm, requests, jinja2, importlib-metadata, torch, huggingface-hub, xformers, tokenizers, diffusers, accelerate, transformers Successfully installed MarkupSafe-2.1.5 Pillow-10.3.0 accelerate-0.29.3 certifi-2024.2.2 charset-normalizer-3.3.2 colorama-0.4.6 diffusers-0.27.2 filelock-3.13.4 fsspec-2024.3.1 hidiffusion-0.1.5 huggingface-hub-0.22.2 idna-3.7 importlib-metadata-7.1.0 jinja2-3.1.3 mpmath-1.3.0 networkx-3.1 numpy-1.24.4 packaging-24.0 psutil-5.9.8 pyyaml-6.0.1 regex-2024.4.16 requests-2.31.0 safetensors-0.4.3 sympy-1.12 tokenizers-0.19.1 torch-2.2.2 tqdm-4.66.2 transformers-4.40.1 typing-extensions-4.11.0 urllib3-2.2.1 xformers-0.0.26.dev778 zipp-3.18.1

(imageinference) F:\Localllm\AlternateInference\inference_engine>

After working through trying to get some updates going to see if it was just some environment issues, I attempted to run it again, and this time got:

(imageinference) F:\Localllm\AlternateInference\inference_engine>python image_inference.py Traceback (most recent call last): File "image_inference.py", line 1, in from hidiffusion import apply_hidiffusion, remove_hidiffusion File "C:\Users---\anaconda3\envs\imageinference\lib\site-packages\hidiffusion__init.py", line 1, in
from .hidiffusion import apply_hidiffusion, remove_hidiffusion File "C:\Users---\anaconda3\envs\imageinference\lib\site-packages\hidiffusion\hidiffusion.py", line 9, in from diffusers.utils import USE_PEFT_BACKEND, replace_example_docstring ImportError: cannot import name 'USE_PEFT_BACKEND' from 'diffusers.utils' (C:\Users---\anaconda3\envs\imageinference\lib\site-packages\diffusers\utils\
init__.py)

Am I missing something?

ShenZhang-Shin commented 2 months ago

The last problem seems that you cannot import USE_PEFT_BACKEND from diffusers. Is your diffusers version==0.27.0. Or you can try diffusers version==0.25.0

arakinas commented 2 months ago

Somehow I had 0.27.2. Updating to 0.1.6 of hidiffusion and 0.27.0 of diffusers resolved the issue. Thank you.