code: def delete_adapter_layers(model, adapter_name):
      from peft.tuners.tuners_utils import BaseTunerLayer
  
      for module in model.modules():
          if isinstance(module, BaseTunerLayer):
              if hasattr(module, "delete_adapter"):
                  module.delete_adapter(adapter_name)
              else:
                  raise ValueError(
                      "The version of PEFT you are using is not compatible, please use a version that is greater than 0.6.1"
                  )
  
      # For transformers integration - we need to pop the adapter from the config
      if getattr(model, "_hf_peft_config_loaded", False) and hasattr(
          model, "peft_config"
      ):
          model.peft_config.pop(adapter_name, None)
          # In case all adapters are deleted, we need to delete the config
          # and make sure to set the flag to False
          if len(model.peft_config) == 0:
              del model.peft_config
              model._hf_peft_config_loaded = None
  
file_path: diffusers/src/diffusers/utils/peft_utils.py
imports: import collections
  import importlib
  from typing import Optional
  from packaging import version
  from .import_utils import is_peft_available, is_torch_available
label_desc: Use image node_id 7 for calling a global function with example usage: delete_adapter_layers(model, adapter_name) without return types