code: def dispatch_default(
      target: torch.nn.Module,
      adapter_name: str,
      lora_config: LoraConfig,
      **kwargs,
  ) -> Optional[torch.nn.Module]:
      new_module = None
  
      if isinstance(target, BaseTunerLayer):
          target_base_layer = target.get_base_layer()
      else:
          target_base_layer = target
  
      if isinstance(target_base_layer, torch.nn.Embedding):
          embedding_kwargs = kwargs.copy()
          embedding_kwargs.pop("fan_in_fan_out", None)
          embedding_kwargs.update(lora_config.loftq_config)
          new_module = Embedding(
              target, adapter_name, **embedding_kwargs
          )
      elif isinstance(target_base_layer, torch.nn.Conv2d):
          kwargs.update(lora_config.loftq_config)
          new_module = Conv2d(target, adapter_name, **kwargs)
      elif isinstance(target_base_layer, torch.nn.Linear):
          if kwargs["fan_in_fan_out"]:
              warnings.warn(
                  "fan_in_fan_out is set to True but the target module is `torch.nn.Linear`. "
                  "Setting fan_in_fan_out to False."
              )
              kwargs[
                  "fan_in_fan_out"
              ] = lora_config.fan_in_fan_out = False
          kwargs.update(lora_config.loftq_config)
          new_module = Linear(target, adapter_name, **kwargs)
      elif isinstance(target_base_layer, Conv1D):
          if not kwargs["fan_in_fan_out"]:
              warnings.warn(
                  "fan_in_fan_out is set to False but the target module is `Conv1D`. "
                  "Setting fan_in_fan_out to True."
              )
              kwargs[
                  "fan_in_fan_out"
              ] = lora_config.fan_in_fan_out = True
          kwargs.update(lora_config.loftq_config)
          new_module = Linear(
              target,
              adapter_name,
              is_target_conv_1d_layer=True,
              **kwargs,
          )
  
      return new_module
  
imports: import math
  import warnings
  from typing import Any, List, Optional, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from transformers.pytorch_utils import Conv1D
  from peft.tuners.tuners_utils import BaseTunerLayer
  from peft.utils.other import transpose
  from .config import LoraConfig
label_desc: Use image node_id 1 for calling a global function with example usage: dispatch_default(target, adapter_name, lora_config) and returns: new_module