code: def load_adapter(model, cfg, adapter, inference=False):
      # type: (PreTrainedModel, DictDefault, Optional[str], bool) -> Tuple[PreTrainedModel, Optional[PeftConfig]]
  
      if adapter is None:
          return model, None
      if hasattr(model, "enable_input_require_grads"):
          model.enable_input_require_grads()
      if adapter in ["lora", "qlora"]:
          return load_lora(model, cfg, inference=inference)
      if adapter == "llama-adapter":
          return load_llama_adapter(model, cfg)
  
      raise NotImplementedError(f"{adapter} peft adapter not available")
  
imports: import logging
  import math
  import os
  from typing import Any, Optional, Tuple, Union
  import addict
  import bitsandbytes
  import torch
  import transformers
  from optimum.bettertransformer import BetterTransformer
  from peft import PeftConfig, prepare_model_for_kbit_training
  from peft.tuners.lora import QuantLinear
  from transformers import AddedToken, AutoConfig, AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, GPTQConfig, PreTrainedModel, PreTrainedTokenizerBase
  from transformers.deepspeed import is_deepspeed_zero3_enabled
  from axolotl.models.mamba import fix_mamba_attn_for_loss
  from axolotl.prompt_tokenizers import LLAMA_DEFAULT_EOS_TOKEN
  from axolotl.utils.bench import log_gpu_memory_usage
  from axolotl.utils.chat_templates import chat_templates
  from axolotl.utils.dict import DictDefault
  from axolotl.utils.lora_embeddings import get_linear_embedding_layers
label_desc: Use image node_id 5 for calling a global function with example usage: load_adapter(model, cfg, adapter, inference) and returns: model,  None, load_lora, load_llama_adapter