code: def listed_weights(self):
      ret = []
      start_layer = (
          self.pipeline_para_rank
          * self.layer_num
          // self.pipeline_para_size
      )
      end_layer = (
          (self.pipeline_para_rank + 1)
          * self.layer_num
          // self.pipeline_para_size
      )
      if not self.int8:
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.query.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 0
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.query.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.key.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 2
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.key.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.value.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 4
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.value.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.dense.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 6
          ret[-1] = (
              ret[-1]
              .split(ret[-1].shape[1] // self.tensor_para_size, dim=1)[
                  self.tensor_para_rank
              ]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.dense.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.LayerNorm.weight"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.LayerNorm.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "intermediate.dense.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 10
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "intermediate.dense.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret[-1] = (
              ret[-1]
              .split(
                  ret[-1].shape[-1] // self.tensor_para_size, dim=-1
              )[self.tensor_para_rank]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.dense.weight"
                      ].transpose(-1, -2)
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )  # 12
          ret[-1] = (
              ret[-1]
              .split(ret[-1].shape[1] // self.tensor_para_size, dim=1)[
                  self.tensor_para_rank
              ]
              .contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.dense.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.LayerNorm.weight"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.LayerNorm.bias"
                      ]
                      for layer_idx in range(start_layer, end_layer)
                  ],
                  0,
              ).contiguous()
          )
      else:
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.query.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 0
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.query.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.key.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 2
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.key.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.value.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 4
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.self.value.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.dense.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 6
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.dense.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.LayerNorm.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "attention.output.LayerNorm.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "intermediate.dense.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 10
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "intermediate.dense.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.dense.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )  # 12
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.dense.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.LayerNorm.weight"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "output.LayerNorm.bias"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "amaxList"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
          ret.append(
              torch.stack(
                  [
                      self.weights[
                          "encoder.layer."
                          + str(layer_idx)
                          + "."
                          + "h_amaxList"
                      ]
                      for layer_idx in range(self.layer_num)
                  ],
                  0,
              ).contiguous()
          )
      return ret
  
imports: from typing import List, Optional
  from loguru import logger
  from nebullvm.optional_modules.torch import torch, torch_distributed
  from nebullvm.optional_modules.huggingface import BertConfig, BertEmbeddings, BertEncoder, BertPooler, BertPreTrainedModel
  from .checkpoint_quantization import checkpoint_quantization
label_desc: Use image node_id 2 for calling the EncoderWeights obj's underlying member method code with example usage: obj.listed_weights() and returns: ret