code: def __init__(
      self,
      model_list,
      tgt_dict_eos,
      beam_size: int = 2,
      quantize: bool = False,
      record_attention: bool = False,
  ):
      super().__init__()
      self.models = model_list
      self.target_dict_eos = tgt_dict_eos
      self.beam_size = beam_size
      self.record_attention = record_attention
  
      # Script the encoder model
      encoder_ens = EncoderEnsemble(self.models, self.beam_size)
      if quantize:
          encoder_ens = tq.quantize_dynamic(
              encoder_ens,
              {torch.nn.Linear},  # Add after bug fix torch.nn.LSTM
              dtype=torch.qint8,
              inplace=False,
          )
  
      self.encoder_ens = torch.jit.script(encoder_ens)
  
      # Script the decoder step
      decoder_ens = DecoderBatchedStepEnsemble(
          self.models, beam_size, record_attention=record_attention
      )
      if quantize:
          decoder_ens = tq.quantize_dynamic(
              decoder_ens,
              {torch.nn.Linear},  # Add after bug fix torch.nn.LSTM
              dtype=torch.qint8,
              inplace=False,
          )
  
      self.decoder_ens = torch.jit.script(decoder_ens)
  
file_path: pytext/pytext/torchscript/seq2seq/beam_search.py
imports: from typing import List, Optional, Tuple
  import torch
  import torch.jit
  import torch.jit.quantized
  from pytext.common.constants import TORCH_VERSION
  from torch import nn
  from .decoder import DecoderBatchedStepEnsemble
  from .encoder import EncoderEnsemble
label_desc: Use image node_id 1 to create a new BeamSearch object from inherited base classes: nn with example: obj = BeamSearch(model_list, tgt_dict_eos, beam_size, quantize, record_attention)