Skip to content

AttributeError: 'StableDiffusionPipeline' object has no attribute 'enable_attention_slicing' #409

@kritonpc

Description

@kritonpc

Describe the bug

I'm getting the error AttributeError: 'StableDiffusionPipeline' object has no attribute 'enable_attention_slicing' Without it I can use stable diffusion properly, but I'm trying to save space, as it uses all 10gb off my 3080

Reproduction

# make sure you're logged in with `huggingface-cli login`
from torch import autocast
from diffusers import StableDiffusionPipeline
import torch

pipe = StableDiffusionPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4", 
    revision="fp16", 
    torch_dtype=torch.float16,
    use_auth_token=True
)
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
pipe.enable_attention_slicing()
with autocast("cuda"):
    image = pipe(prompt).images[0]  

Logs

Traceback (most recent call last):
  File "c:/Users/Mr.Gamio/Programming/AIPicGen/Tests/testSingle.py", line 24, in <module>
    pipe.enable_attention_slicing()
AttributeError: 'StableDiffusionPipeline' object has no attribute 'enable_attention_slicing'

System Info

I actually get the error

Traceback (most recent call last):
  File "c:\users\mr.gamio\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\mr.gamio\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Mr.Gamio\AppData\Local\Programs\Python\Python37\Scripts\diffusers-cli.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'diffusers.commands'

when calling diffusers-cli env
I am on windows 10 with an nvidia 3080 with the latest version of diffusers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions