code: def __init__(self, args, dictionary, embed_tokens, **kwargs):
      self.args = args
      super().__init__(dictionary)
  
      self._future_mask = torch.empty(0)
  
      embed_dim = args.decoder_embed_dim
      self.embed_tokens = embed_tokens
      self.padding_idx = self.embed_tokens.config.padding_idx
  
      self.layers = nn.ModuleList(
          [
              self.build_decoder_layer(args)
              for _ in range(args.decoder_layers)
          ]
      )
      self.num_layers = len(self.layers)
  
      if args.decoder_normalize_before and not getattr(
          args, "no_decoder_final_norm", False
      ):
          self.layer_norm = LayerNorm(embed_dim)
      else:
          self.layer_norm = None
  
      if args.use_torch_layer:
          self.output_projection = QuantLinear(
              self.embed_tokens.embeddings.shape[1],
              self.embed_tokens.embeddings.shape[0],
              bias=False,
          )
          self.output_projection.weight_quant = (
              self.embed_tokens.emb_quant
          )
          self.output_projection.weight = self.embed_tokens.embeddings
      else:
          from lightseq.training.ops.pytorch.quant_linear_layer import (
              LSQuantLinearLayer,
          )
  
          config = LSQuantLinearLayer.get_config(
              max_batch_tokens=self.args.max_tokens,
              in_features=self.embed_tokens.config.embedding_dim,
              out_features=self.embed_tokens.config.vocab_size,
              bias=False,
              fp16=self.args.fp16,
              local_rank=self.args.device_id,
          )
          self.output_projection = LSQuantLinearLayer(config)
          del self.output_projection.weight
  
      self.quant_mode = args.enable_quant
      self.use_torch_layer = args.use_torch_layer
  
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 LSTransformerDecoder object from inherited base classes: FairseqIncrementalDecoder with example: obj = LSTransformerDecoder(args, dictionary, embed_tokens)