code: def mark_only_lora_as_trainable(
      model: nn.Module, bias: str = "none"
  ) -> None:
      for n, p in model.named_parameters():
          if "lora_" not in n:
              p.requires_grad = False
      if bias == "none":
          return
      elif bias == "all":
          for n, p in model.named_parameters():
              if "bias" in n:
                  p.requires_grad = True
      elif bias == "lora_only":
          for m in model.modules():
              if (
                  isinstance(m, LoRALayer)
                  and hasattr(m, "bias")
                  and m.bias is not None
              ):
                  m.bias.requires_grad = True
      else:
          raise NotImplementedError
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import math
  from torch.utils.checkpoint import checkpoint
  from typing import Dict
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: mark_only_lora_as_trainable(model, bias) without return types