code: def __init__(self, args, dictionary, embed_tokens):
      self.args = args
      super().__init__(dictionary)
  
      embed_dim = args.encoder_embed_dim
      self.embed_tokens = embed_tokens
      self.padding_idx = self.embed_tokens.config.padding_idx
  
      self.layers = nn.ModuleList(
          [
              self.build_encoder_layer(args)
              for _ in range(args.encoder_layers)
          ]
      )
      self.num_layers = len(self.layers)
  
      if args.encoder_normalize_before:
          self.layer_norm = LayerNorm(embed_dim)
      else:
          self.layer_norm = None
  
imports: import torch
  import torch.nn
  from fairseq import utils
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture
  from fairseq.models.fairseq_encoder import EncoderOut
  from fairseq.modules import LayerNorm
  from lightseq.training.ops.pytorch.layer_base import TransformerEmbeddingLayerBase
  from lightseq.training.ops.pytorch.quantization import QuantLinear, disable_quant, enable_quant, ptq_mode, qat_mode
label_desc: Use image node_id 1 to create a new LSTransformerEncoder object from inherited base classes: FairseqEncoder with example: obj = LSTransformerEncoder(args, dictionary, embed_tokens)