Skip to content

AttributeError: 'StableDiffusionMegaPipeline' object has no attribute 'requires_safety_checker' #3211

@KevinColemanInc

Description

@KevinColemanInc

Describe the bug

Sample code in the readme throws an error

stable_diffusion_mega

AttributeError: 'StableDiffusionMegaPipeline' object has no attribute 'requires_safety_checker'

Reproduction

Run the sample code in the readme. I changed the pipeline to use mips, b/c I have an m1

pipe.to("mps")
pipe.enable_attention_slicing()

Logs

/opt/homebrew/Caskroom/miniforge/base/envs/replate_env/lib/python3.10/site-packages/huggingface_hub/file_download.py:637: FutureWarning: `cached_download` is the legacy way to download files from the HF hub, please consider upgrading to `hf_hub_download`
  warnings.warn(
vae/diffusion_pytorch_model.safetensors not found
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["id2label"]` will be overriden.
/opt/homebrew/Caskroom/miniforge/base/envs/replate_env/lib/python3.10/site-packages/transformers/models/clip/feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead.
  warnings.warn(
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/kevin/projects/replate/py/inpaintdenoisemega.py:14 in <module>                            │
│                                                                                                  │
│   11 │   return PIL.Image.open(BytesIO(response.content)).convert("RGB")                         │
│   12                                                                                             │
│   13 pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", custom_pipeli    │
│ ❱ 14 pipe.to("mps")                                                                              │
│   15 # pipe.enable_attention_slicing()                                                           │
│   16                                                                                             │
│   17                                                                                             │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/envs/replate_env/lib/python3.10/site-packages/diffusers/pi │
│ pelines/pipeline_utils.py:623 in to                                                              │
│                                                                                                  │
│    620 │   │                                                                                     │
│    621 │   │   # .to("cuda") would raise an error if the pipeline is sequentially offloaded, so  │
│    622 │   │   pipeline_is_sequentially_offloaded = any(                                         │
│ ❱  623 │   │   │   module_is_sequentially_offloaded(module) for _, module in self.components.it  │
│    624 │   │   )                                                                                 │
│    625 │   │   if pipeline_is_sequentially_offloaded and torch.device(torch_device).type == "cu  │
│    626 │   │   │   raise ValueError(                                                             │
│                                                                                                  │
│ /Users/kevin/.cache/huggingface/modules/diffusers_modules/git/stable_diffusion_mega.py:94 in     │
│ components                                                                                       │
│                                                                                                  │
│    91 │                                                                                          │
│    92 │   @property                                                                              │
│    93 │   def components(self) -> Dict[str, Any]:                                                │
│ ❱  94 │   │   return {k: getattr(self, k) for k in self.config.keys() if not k.startswith("_")   │
│    95 │                                                                                          │
│    96 │   def enable_attention_slicing(self, slice_size: Optional[Union[str, int]] = "auto"):    │
│    97 │   │   r"""                                                                               │
│                                                                                                  │
│ /Users/kevin/.cache/huggingface/modules/diffusers_modules/git/stable_diffusion_mega.py:94 in     │
│ <dictcomp>                                                                                       │
│                                                                                                  │
│    91 │                                                                                          │
│    92 │   @property                                                                              │
│    93 │   def components(self) -> Dict[str, Any]:                                                │
│ ❱  94 │   │   return {k: getattr(self, k) for k in self.config.keys() if not k.startswith("_")   │
│    95 │                                                                                          │
│    96 │   def enable_attention_slicing(self, slice_size: Optional[Union[str, int]] = "auto"):    │
│    97 │   │   r"""
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'StableDiffusionMegaPipeline' object has no attribute 'requires_safety_checker'

System Info

- `diffusers` version: 0.15.0
- Platform: macOS-13.3.1-arm64-arm-64bit
- Python version: 3.10.10
- PyTorch version (GPU?): 2.1.0.dev20230415 (False)
- Huggingface_hub version: 0.13.4
- Transformers version: 4.28.1
- Accelerate version: 0.18.0
- xFormers version: not installed
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: <fill in>

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