code: def __init__(self, config, embed_tokens):
      super(LSTransformerEncoder, self).__init__()
      self.config = config
  
      embed_dim = embed_tokens.config.embedding_dim
      self.embed_tokens = embed_tokens
      self.padding_idx = self.config.padding_idx
  
      self.layers = nn.ModuleList(
          [
              self.build_encoder_layer(config)
              for _ in range(config.num_encoder_layer)
          ]
      )
      self.num_layers = len(self.layers)
  
      self.layer_norm = nn.LayerNorm(embed_dim)
  
imports: from dataclasses import dataclass
  import torch
  import torch.nn
  from lightseq.training import LSTransformerEmbeddingLayer, LSTransformerEncoderLayer, LSTransformerDecoderLayer
  from lightseq.training.ops.pytorch.util import MODEL_ARCH
  from lightseq.training.ops.pytorch.quantization import QuantLinear
label_desc: Use image node_id 1 to create a new LSTransformerEncoder object from inherited base classes: nn with example: obj = LSTransformerEncoder(config, embed_tokens)