class_docstr: Sequence to sequence model using an encoder-decoder architecture.
class_docstr_tok: ["Sequence","to","sequence","model","using","an","encoder-decoder","architecture","."]
code: def __init__(
      self,
      model: RNNModel,
      output_layer: Seq2SeqOutputLayer,
      src_vocab: Vocabulary,
      trg_vocab: Vocabulary,
      dictfeat_vocab: Vocabulary,
      generator_config=None,
  ):
      BaseModel.__init__(self)
      self.model = model
      self.output_layer = output_layer
  
      # Sequence generation is expected to be used only for inference, and to
      # take the trained model(s) as input. Creating the sequence generator
      # may apply Torchscript JIT compilation and quantization, which modify
      # the input model. Therefore, we want to create the sequence generator
      # after training.
      if generator_config is not None:
          self.sequence_generator_builder = (
              lambda models: create_module(
                  generator_config, models, trg_vocab.get_eos_index()
              )
          )
      self.sequence_generator = None
  
      # Disable predictions until testing (see above comment about sequence
      # generator). If this functionality is needed, a new sequence generator
      # with a copy of the model should be used for each epoch during the
      # EVAL stage.
      self.force_eval_predictions = False
  
      # Target vocab EOS index is useful for recognizing when to stop generating
      self.trg_eos_index = trg_vocab.get_eos_index()
  
      # Target vocab PAD index is useful for shifting source/target prior to decoding
      self.trg_pad_index = trg_vocab.get_pad_index()
  
      # Source, target and dictfeat vocab are needed for export so that we can handle
      # string input
      self.src_dict = src_vocab
      self.trg_dict = trg_vocab
      self.dictfeat_dict = dictfeat_vocab
  
      log_class_usage(__class__)
  
imports: from typing import Callable, Dict, List, Optional, Tuple
  import torch
  from pytext.common.constants import Stage
  from pytext.data.tensorizers import ByteTokenTensorizer, GazetteerTensorizer, Tensorizer, TokenTensorizer
  from pytext.data.utils import Vocabulary
  from pytext.models.embeddings import ContextualTokenEmbedding, DictEmbedding, WordEmbedding
  from pytext.models.embeddings.scriptable_embedding_list import ScriptableEmbeddingList
  from pytext.models.model import BaseModel, Model
  from pytext.models.module import create_module
  from pytext.torchscript.seq2seq.export_model import Seq2SeqJIT
  from pytext.torchscript.seq2seq.scripted_seq2seq_generator import ScriptedSequenceGenerator
  from pytext.utils.cuda import GetTensor
  from pytext.utils.usage import log_class_usage
  from .rnn_encoder_decoder import RNNModel
  from .seq2seq_output_layer import Seq2SeqOutputLayer
label_desc: Use image node_id 4 to create a new Seq2SeqModel object from inherited base classes: Model with example: obj = Seq2SeqModel(model, output_layer, src_vocab, trg_vocab, dictfeat_vocab, generator_config)