code: def create_module(self, weights, key, none_ok=False):
      weight = weights.get(key)
  
      if weight is None and none_ok:
          return None
  
      is_linear = type(self.sd_module) in [
          torch.nn.Linear,
          torch.nn.modules.linear.NonDynamicallyQuantizableLinear,
          torch.nn.MultiheadAttention,
      ]
      is_conv = type(self.sd_module) in [torch.nn.Conv2d]
  
      if is_linear:
          weight = weight.reshape(weight.shape[0], -1)
          module = torch.nn.Linear(
              weight.shape[1], weight.shape[0], bias=False
          )
      elif is_conv and key == "lora_down.weight" or key == "dyn_up":
          if len(weight.shape) == 2:
              weight = weight.reshape(weight.shape[0], -1, 1, 1)
  
          if weight.shape[2] != 1 or weight.shape[3] != 1:
              module = torch.nn.Conv2d(
                  weight.shape[1],
                  weight.shape[0],
                  self.sd_module.kernel_size,
                  self.sd_module.stride,
                  self.sd_module.padding,
                  bias=False,
              )
          else:
              module = torch.nn.Conv2d(
                  weight.shape[1], weight.shape[0], (1, 1), bias=False
              )
      elif is_conv and key == "lora_mid.weight":
          module = torch.nn.Conv2d(
              weight.shape[1],
              weight.shape[0],
              self.sd_module.kernel_size,
              self.sd_module.stride,
              self.sd_module.padding,
              bias=False,
          )
      elif is_conv and key == "lora_up.weight" or key == "dyn_down":
          module = torch.nn.Conv2d(
              weight.shape[1], weight.shape[0], (1, 1), bias=False
          )
      else:
          raise AssertionError(
              f"Lora layer {self.network_key} matched a layer with unsupported type: {type(self.sd_module).__name__}"
          )
  
      with torch.no_grad():
          if weight.shape != module.weight.shape:
              weight = weight.reshape(module.weight.shape)
          module.weight.copy_(weight)
  
      module.to(device=devices.cpu, dtype=devices.dtype)
      module.weight.requires_grad_(False)
  
      return module
  
file_path: stable-diffusion-webui/extensions-builtin/Lora/network_lora.py
imports: import torch
  import lyco_helpers
  import network
  from modules import devices
label_desc: Use image node_id 2 for calling the NetworkModuleLora obj's underlying member method code with example usage: obj.create_module(weights, key, none_ok) and returns: module, None