class_docstr: Implements a full generator model, with one encoder and one decoder.
class_docstr_tok: ["Implements","a","full","generator","model",",","with","one","encoder","and","one","decoder","."]
code: def __init__(self, opt: Opt, dictionary: DictionaryAgent, **kwargs):
      self.pad_idx = dictionary[dictionary.null_token]
      self.start_idx = dictionary[dictionary.start_token]
      self.end_idx = dictionary[dictionary.end_token]
      super().__init__(
          self.pad_idx, self.start_idx, self.end_idx, **kwargs
      )
      self.opt = opt
      self.embeddings = create_embeddings(
          dictionary, opt["embedding_size"], self.pad_idx
      )
  
      self.encoder = self.build_encoder(
          opt,
          dictionary,
          self.embeddings,
          self.pad_idx,
          reduction_type=None,
          encoder_class=self.swappables.encoder,  # type: ignore
      )
      self.decoder = self.build_decoder(
          opt,
          embedding=self.embeddings,
          decoder_class=self.swappables.decoder,  # type: ignore
          dictionary=dictionary,
      )
  
file_path: ParlAI/parlai/agents/transformer/modules/generator.py
imports: from __future__ import annotations
  from typing import Dict, Type
  import torch
  import torch.cuda
  import torch.nn.functional
  from parlai.agents.transformer.modules import create_embeddings, TransformerDecoder, TransformerEncoder
  from parlai.agents.transformer.modules.modular import swappable
  from parlai.core.opt import Opt
  from parlai.core.torch_agent import DictionaryAgent
  from parlai.core.torch_generator_agent import TorchGeneratorModel
  from parlai.utils.torch import neginf
label_desc: Use image node_id 3 to create a new TransformerGeneratorModel object from inherited base classes: TorchGeneratorModel with example: obj = TransformerGeneratorModel(opt, dictionary)