class_docstr: Load LoRA layers into [`UNet2DConditionModel`] and
  [`CLIPTextModel`](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel).
class_docstr_tok: ["Load","LoRA","layers","into","[","`","UNet2DConditionModel","`","]","and","[","`","CLIPTextModel","`","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/clip","#","transformers.CLIPTextModel",")","."]
docstr: Reverses the effect of
  [`pipe.fuse_lora()`](https://huggingface.co/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora).
  
  <Tip warning={true}>
  
  This is an experimental API.
  
  </Tip>
  
  Args:
      unfuse_unet (`bool`, defaults to `True`): Whether to unfuse the UNet LoRA parameters.
      unfuse_text_encoder (`bool`, defaults to `True`):
          Whether to unfuse the text encoder LoRA parameters. If the text encoder wasn't monkey-patched with the
          LoRA parameters then it won't have any effect.
docstr_tok: ["Reverses","the","effect","of","[","`","pipe.fuse_lora","(",")","`","]","(","https",":","\/\/huggingface.co\/docs\/diffusers\/main\/en\/api\/loaders","#","diffusers.loaders.LoraLoaderMixin.fuse_lora",")",".","<","Tip","warning=","{","true","}",">","This","is","an","experimental","API",".","<","\/Tip",">","Args",":","unfuse_unet","(","`","bool","`",",","defaults","to","`","True","`",")",":","Whether","to","unfuse","the","UNet","LoRA","parameters",".","unfuse_text_encoder","(","`","bool","`",",","defaults","to","`","True","`",")",":","Whether","to","unfuse","the","text","encoder","LoRA","parameters",".","If","the","text","encoder","was","n't","monkey-patched","with","the","LoRA","parameters","then","it","wo","n't","have","any","effect","."]
code: def unfuse_lora(
      self, unfuse_unet: bool = True, unfuse_text_encoder: bool = True
  ):
      r"""
      Reverses the effect of
      [`pipe.fuse_lora()`](https://huggingface.co/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora).
  
      <Tip warning={true}>
  
      This is an experimental API.
  
      </Tip>
  
      Args:
          unfuse_unet (`bool`, defaults to `True`): Whether to unfuse the UNet LoRA parameters.
          unfuse_text_encoder (`bool`, defaults to `True`):
              Whether to unfuse the text encoder LoRA parameters. If the text encoder wasn't monkey-patched with the
              LoRA parameters then it won't have any effect.
      """
      unet = (
          getattr(self, self.unet_name)
          if not hasattr(self, "unet")
          else self.unet
      )
      if unfuse_unet:
          if not USE_PEFT_BACKEND:
              unet.unfuse_lora()
          else:
              from peft.tuners.tuners_utils import BaseTunerLayer
  
              for module in unet.modules():
                  if isinstance(module, BaseTunerLayer):
                      module.unmerge()
  
      if USE_PEFT_BACKEND:
          from peft.tuners.tuners_utils import BaseTunerLayer
  
          def unfuse_text_encoder_lora(text_encoder):
              for module in text_encoder.modules():
                  if isinstance(module, BaseTunerLayer):
                      module.unmerge()
  
      else:
          deprecate(
              "unfuse_text_encoder_lora",
              "0.27",
              LORA_DEPRECATION_MESSAGE,
          )
  
          def unfuse_text_encoder_lora(text_encoder):
              for _, attn_module in text_encoder_attn_modules(
                  text_encoder
              ):
                  if isinstance(
                      attn_module.q_proj, PatchedLoraProjection
                  ):
                      attn_module.q_proj._unfuse_lora()
                      attn_module.k_proj._unfuse_lora()
                      attn_module.v_proj._unfuse_lora()
                      attn_module.out_proj._unfuse_lora()
  
              for _, mlp_module in text_encoder_mlp_modules(
                  text_encoder
              ):
                  if isinstance(mlp_module.fc1, PatchedLoraProjection):
                      mlp_module.fc1._unfuse_lora()
                      mlp_module.fc2._unfuse_lora()
  
      if unfuse_text_encoder:
          if hasattr(self, "text_encoder"):
              unfuse_text_encoder_lora(self.text_encoder)
          if hasattr(self, "text_encoder_2"):
              unfuse_text_encoder_lora(self.text_encoder_2)
  
      self.num_fused_loras -= 1
  
imports: import inspect
  import os
  from contextlib import nullcontext
  from pathlib import Path
  from typing import Callable, Dict, List, Optional, Union
  import safetensors
  import torch
  from huggingface_hub import model_info
  from huggingface_hub.constants import HF_HUB_OFFLINE
  from huggingface_hub.utils import validate_hf_hub_args
  from packaging import version
  from torch import nn
  from ..None import __version__
  from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, load_model_dict_into_meta
  from ..utils import USE_PEFT_BACKEND, _get_model_file, convert_state_dict_to_diffusers, convert_state_dict_to_peft, convert_unet_state_dict_to_peft, delete_adapter_layers, deprecate, get_adapter_name, get_peft_kwargs, is_accelerate_available, is_transformers_available, logging, recurse_remove_peft_layers, scale_lora_layers, set_adapter_layers, set_weights_and_activate_adapters
  from .lora_conversion_utils import _convert_kohya_lora_to_diffusers, _maybe_map_sgm_blocks_to_diffusers
label_desc: Use image node_id 16 for calling the LoraLoaderMixin obj's underlying member method code with example usage: obj.unfuse_lora(unfuse_unet, unfuse_text_encoder) without return types