exx8/differential-diffusion

AttributeError: 'StableDiffusionXLDiffImg2ImgPipeline' object has no attribute '_execution_device'

Opened this issue · 4 comments

When running the script for SDXL, I get the following error:
The config attributes {'force_upcast': True} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file.
Traceback (most recent call last):
File "G:\ComfyUI_windows_portable\differential-diffusion\SDXL\run.py", line 49, in
edited_images = base(prompt=prompt, original_image=image, image=image, strength=1, guidance_scale=17.5,
File "G:\ComfyUI_windows_portable\differential-diffusion\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\ComfyUI_windows_portable\differential-diffusion\SDXL\diff_pipe.py", line 853, in call
device = self._execution_device
File "G:\ComfyUI_windows_portable\differential-diffusion\venv\lib\site-packages\diffusers\configuration_utils.py", line 137, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'StableDiffusionXLDiffImg2ImgPipeline' object has no attribute '_execution_device'

exx8 commented

Hello,
Thank you for your interest in Differential Diffusion!

  1. Please provide the content of pip freeze of the venv you use.
  2. What Python version do you use?
  3. In the meantime, replace:
    device = device or self._execution_device

    by
    device="cuda"
    and replace:
    device = self._execution_device

    by
    device="cuda"
    Does the pipeline work now?

Here's the pip freeze:
accelerate==0.27.2
certifi==2024.2.2
charset-normalizer==3.3.2
colorama==0.4.6
diffusers==0.18.0
filelock==3.9.0
fsspec==2024.2.0
huggingface-hub==0.20.3
idna==3.6
importlib-metadata==7.0.1
Jinja2==3.1.2
MarkupSafe==2.1.3
mpmath==1.3.0
networkx==3.2.1
numpy==1.26.3
packaging==23.2
pillow==10.2.0
psutil==5.9.8
PyYAML==6.0.1
regex==2023.12.25
requests==2.31.0
safetensors==0.4.2
sympy==1.12
tokenizers==0.15.2
torch==2.2.1+cu121
torchaudio==2.2.1+cu121
torchvision==0.17.1+cu121
tqdm==4.66.2
transformers==4.38.0
typing_extensions==4.8.0
urllib3==2.2.1
zipp==3.17.0

I'm using Python 3.10.11

After replacing the lines in the diff_pipe.py file and running the script I now get this error:
Traceback (most recent call last):
File "G:\ComfyUI_windows_portable\differential-diffusion\SDXL\run.py", line 49, in
edited_images = base(prompt=prompt, original_image=image, image=image, strength=1, guidance_scale=17.5,
File "G:\ComfyUI_windows_portable\differential-diffusion\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\ComfyUI_windows_portable\differential-diffusion\SDXL\diff_pipe.py", line 1033, in call
return StableDiffusionXLPipelineOutput(images=image)
TypeError: StableDiffusionXLPipelineOutput.init() missing 1 required positional argument: 'nsfw_content_detected'

exx8 commented

So, the virtual environment (venv) you're using has different dependencies installed than what is required. Specifically, you're using an older version of the diffuser package compared to what is listed in requirements.txt

diffusers==0.19.3

Additionally, the Python version is newer, but I believe that, besides some warnings during installation, this will not cause any issues.
See:
https://github.com/exx8/differential-diffusion?tab=readme-ov-file#installation
For the expected installation process.
Thanks for the cooperation.