class_docstr: Core trainable object in OpenNMT. Implements a trainable interface
  for a simple, generic encoder / decoder or decoder only model.
  
  Args:
    encoder (onmt.encoders.EncoderBase): an encoder object
    decoder (onmt.decoders.DecoderBase): a decoder object
class_docstr_tok: ["Core","trainable","object","in","OpenNMT",".","Implements","a","trainable","interface","for","a","simple",",","generic","encoder","\/","decoder","or","decoder","only","model",".","Args",":","encoder","(","onmt.encoders.EncoderBase",")",":","an","encoder","object","decoder","(","onmt.decoders.DecoderBase",")",":","a","decoder","object"]
code: def _load_param(
      self, name, module, param_name, param, buf_list, ckpt_t, offset
  ):
      if module.__class__.__name__ == "WQLinear_GEMM":
          # ugly patch because in_feat and out_feat are reversed in WQLinear_GEMM
          param.data = param.data.transpose(0, 1)
          ckpt_t = ckpt_t.transpose(0, 1)
      if name.split(".")[-1] in [
          "linear_keys",
          "linear_values",
          "linear_query",
          "w_1",
          "w_3",
      ]:
          col_slice_start = param.data.size(0) * offset
          col_slice_end = param.data.size(0) * (offset + 1)
      else:
          col_slice_start = 0
          col_slice_end = param.data.size(0)
      if param.data.dim() == 2:
          if name.split(".")[-1] in ["final_linear", "w_2"]:
              row_slice_start = param.data.size(1) * offset
              row_slice_end = param.data.size(1) * (offset + 1)
          else:
              row_slice_start = 0
              row_slice_end = param.data.size(1)
          assert (
              param.data.size()
              == ckpt_t[
                  col_slice_start:col_slice_end,
                  row_slice_start:row_slice_end,
              ].size()
          ), "An error in model's partition and checkpoint's slice was detected"
          if name + "." + param_name in buf_list:
              if module.__class__.__name__ == "WQLinear_GEMM":
                  module.register_buffer(
                      param_name,
                      ckpt_t[
                          col_slice_start:col_slice_end,
                          row_slice_start:row_slice_end,
                      ].transpose(0, 1),
                  )
              else:
                  module.register_buffer(
                      param_name,
                      ckpt_t[
                          col_slice_start:col_slice_end,
                          row_slice_start:row_slice_end,
                      ],
                  )
          else:
              param.data = ckpt_t[
                  col_slice_start:col_slice_end,
                  row_slice_start:row_slice_end,
              ]
      else:
          assert (
              param.data.size()
              == ckpt_t[col_slice_start:col_slice_end].size()
          ), "An error in model's partition and checkpoint's slice was detected"
          if name + "." + param_name in buf_list:
              module.register_buffer(
                  param_name, ckpt_t[col_slice_start:col_slice_end]
              )
          else:
              param.data = ckpt_t[col_slice_start:col_slice_end]
  
imports: import torch
  import torch.nn
  from glob import glob
label_desc: Use image node_id 5 for calling the BaseModel obj's underlying member method code with example usage: obj._load_param(name, module, param_name, param, buf_list, ckpt_t, offset) without return types