class_docstr: Base class for all pipelines.
  
  [`DiffusionPipeline`] stores all components (models, schedulers, and processors) for diffusion pipelines and
  provides methods for loading, downloading and saving models. It also includes methods to:
  
      - move all PyTorch modules to the device of your choice
      - enable/disable the progress bar for the denoising iteration
  
  Class attributes:
  
      - **config_name** (`str`) -- The configuration filename that stores the class and module names of all the
        diffusion pipeline's components.
      - **_optional_components** (`List[str]`) -- List of all optional components that don't have to be passed to the
        pipeline to function (should be overridden by subclasses).
class_docstr_tok: ["Base","class","for","all","pipelines",".","[","`","DiffusionPipeline","`","]","stores","all","components","(","models",",","schedulers",",","and","processors",")","for","diffusion","pipelines","and","provides","methods","for","loading",",","downloading","and","saving","models",".","It","also","includes","methods","to",":","-","move","all","PyTorch","modules","to","the","device","of","your","choice","-","enable\/disable","the","progress","bar","for","the","denoising","iteration","Class","attributes",":","-","*","*","config_name","*","*","(","`","str","`",")","--","The","configuration","filename","that","stores","the","class","and","module","names","of","all","the","diffusion","pipeline","'s","components",".","-","*","*","_optional_components","*","*","(","`","List","[","str","]","`",")","--","List","of","all","optional","components","that","do","n't","have","to","be","passed","to","the","pipeline","to","function","(","should","be","overridden","by","subclasses",")","."]
docstr: Enable memory efficient attention from [xFormers](https://facebookresearch.github.io/xformers/). When this
  option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
  up during training is not guaranteed.
  
  <Tip warning={true}>
  
  ⚠️ When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
  precedent.
  
  </Tip>
  
  Parameters:
      attention_op (`Callable`, *optional*):
          Override the default `None` operator for use as `op` argument to the
          [`memory_efficient_attention()`](https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention)
          function of xFormers.
  
  Examples:
  
  ```py
  >>> import torch
  >>> from diffusers import DiffusionPipeline
  >>> from xformers.ops import MemoryEfficientAttentionFlashAttentionOp
  
  >>> pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
  >>> pipe = pipe.to("cuda")
  >>> pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
  >>> # Workaround for not accepting attention shape using VAE for Flash Attention
  >>> pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None)
  ```
docstr_tok: ["Enable","memory","efficient","attention","from","[","xFormers","]","(","https",":","\/\/facebookresearch.github.io\/xformers\/",")",".","When","this","option","is","enabled",",","you","should","observe","lower","GPU","memory","usage","and","a","potential","speed","up","during","inference",".","Speed","up","during","training","is","not","guaranteed",".","<","Tip","warning=","{","true","}",">","\u26a0\ufe0f","When","memory","efficient","attention","and","sliced","attention","are","both","enabled",",","memory","efficient","attention","takes","precedent",".","<","\/Tip",">","Parameters",":","attention_op","(","`","Callable","`",",","*","optional","*",")",":","Override","the","default","`","None","`","operator","for","use","as","`","op","`","argument","to","the","[","`","memory_efficient_attention","(",")","`","]","(","https",":","\/\/facebookresearch.github.io\/xformers\/components\/ops.html","#","xformers.ops.memory_efficient_attention",")","function","of","xFormers",".","Examples",":","``","`","py",">",">",">","import","torch",">",">",">","from","diffusers","import","DiffusionPipeline",">",">",">","from","xformers.ops","import","MemoryEfficientAttentionFlashAttentionOp",">",">",">","pipe","=","DiffusionPipeline.from_pretrained","(","``","stabilityai\/stable-diffusion-2-1","''",",","torch_dtype=torch.float16",")",">",">",">","pipe","=","pipe.to","(","``","cuda","''",")",">",">",">","pipe.enable_xformers_memory_efficient_attention","(","attention_op=MemoryEfficientAttentionFlashAttentionOp",")",">",">",">","#","Workaround","for","not","accepting","attention","shape","using","VAE","for","Flash","Attention",">",">",">","pipe.vae.enable_xformers_memory_efficient_attention","(","attention_op=None",")","``","`"]
code: def enable_xformers_memory_efficient_attention(
      self, attention_op: Optional[Callable] = None
  ):
      r"""
      Enable memory efficient attention from [xFormers](https://facebookresearch.github.io/xformers/). When this
      option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
      up during training is not guaranteed.
  
      <Tip warning={true}>
  
      ⚠️ When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
      precedent.
  
      </Tip>
  
      Parameters:
          attention_op (`Callable`, *optional*):
              Override the default `None` operator for use as `op` argument to the
              [`memory_efficient_attention()`](https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention)
              function of xFormers.
  
      Examples:
  
      ```py
      >>> import torch
      >>> from diffusers import DiffusionPipeline
      >>> from xformers.ops import MemoryEfficientAttentionFlashAttentionOp
  
      >>> pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
      >>> pipe = pipe.to("cuda")
      >>> pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
      >>> # Workaround for not accepting attention shape using VAE for Flash Attention
      >>> pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None)
      ```
      """
      self.set_use_memory_efficient_attention_xformers(
          True, attention_op
      )
  
imports: import fnmatch
  import importlib
  import inspect
  import os
  import re
  import sys
  import warnings
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import requests
  import torch
  from huggingface_hub import ModelCard, create_repo, hf_hub_download, model_info, snapshot_download
  from huggingface_hub.utils import OfflineModeIsEnabled, validate_hf_hub_args
  from packaging import version
  from requests.exceptions import HTTPError
  from tqdm.auto import tqdm
  from ..None import __version__
  from ..configuration_utils import ConfigMixin
  from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT
  from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME
  from ..utils import CONFIG_NAME, DEPRECATED_REVISION_ARGS, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME, BaseOutput, deprecate, get_class_from_dynamic_module, is_accelerate_available, is_accelerate_version, is_peft_available, is_torch_version, is_transformers_available, logging, numpy_to_pil
  from ..utils.torch_utils import is_compiled_module
  from ..utils import FLAX_WEIGHTS_NAME, ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, PushToHubMixin
label_desc: Use image node_id 19 for calling the DiffusionPipeline obj's underlying member method code with example usage: obj.enable_xformers_memory_efficient_attention(attention_op) without return types