class_docstr: A class that allows to mix different types of adapters in a single model.
  
  Note: This class should usually not be initialized directly. Instead, use `get_peft_model` with the argument
  `mixed=True`.
  
  Args:
      model (:obj:`nn.Module`):
          The model to be tuned.
      config (:obj:`PeftConfig`):
          The config of the model to be tuned. The adapter type must be compatible.
      adapter_name (:obj:`str`):
          The name of the first adapter.
class_docstr_tok: ["A","class","that","allows","to","mix","different","types","of","adapters","in","a","single","model",".","Note",":","This","class","should","usually","not","be","initialized","directly",".","Instead",",","use","`","get_peft_model","`","with","the","argument","`","mixed=True","`",".","Args",":","model","(",":","obj",":","`","nn.Module","`",")",":","The","model","to","be","tuned",".","config","(",":","obj",":","`","PeftConfig","`",")",":","The","config","of","the","model","to","be","tuned",".","The","adapter","type","must","be","compatible",".","adapter_name","(",":","obj",":","`","str","`",")",":","The","name","of","the","first","adapter","."]
code: def _mark_only_adapters_as_trainable(self, model: nn.Module) -> None:
      for n, p in model.named_parameters():
          if not any(prefix in n for prefix in PREFIXES):
              p.requires_grad = False
  
      for active_adapter in self.active_adapters:
          bias = getattr(
              self.peft_config[active_adapter], "bias", "none"
          )
          if bias == "none":
              continue
  
          if bias == "all":
              for n, p in model.named_parameters():
                  if "bias" in n:
                      p.requires_grad = True
          elif bias == "lora_only":
              # TODO: check if this is needed for other supported types
              for m in model.modules():
                  if (
                      isinstance(m, Layers)
                      and hasattr(m, "bias")
                      and m.bias is not None
                  ):
                      m.bias.requires_grad = True
          else:
              raise ValueError(
                  f"Requested bias: {bias}, is not implemented."
              )
  
imports: from __future__ import annotations
  import warnings
  from typing import Any, Optional, Union
  from torch import nn
  from tqdm import tqdm
  from peft.tuners import adalora, loha, lokr, lora, oft
  from peft.tuners.tuners_utils import BaseTuner, BaseTunerLayer, check_target_module_exists
  from peft.utils import TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPING, ModulesToSaveWrapper, PeftType, _get_submodules, get_auto_gptq_quant_linear
label_desc: Use image node_id 6 for calling the MixedModel obj's underlying member method code with example usage: obj._mark_only_adapters_as_trainable(model) without return types