class_docstr: TransformerGeneratorAgent.
  
  Implementation of TorchGeneratorAgent, where the model is a Transformer
class_docstr_tok: ["TransformerGeneratorAgent",".","Implementation","of","TorchGeneratorAgent",",","where","the","model","is","a","Transformer"]
docstr: Build and return model.
docstr_tok: ["Build","and","return","model","."]
code: def build_model(self, states=None):
      """
      Build and return model.
      """
      _check_positional_embeddings(self.opt)
      model = TransformerGeneratorModel(self.opt, self.dict)
      if self.opt["embedding_type"] != "random":
          self._copy_embeddings(
              model.encoder.embeddings.weight,
              self.opt["embedding_type"],
          )
      return model
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.agents import Agent
  from parlai.utils.torch import padded_3d
  from parlai.core.torch_classifier_agent import TorchClassifierAgent
  from parlai.core.torch_ranker_agent import TorchRankerAgent
  from parlai.core.torch_generator_agent import TorchGeneratorAgent
  from parlai.utils.misc import recursive_getattr, warn_once
  from parlai.utils.logging import logging
  from parlai.utils.fsdp import should_use_fsdp
  from .modules import TransformerMemNetModel, TransformerGeneratorModel, TransformerLinearWrapper
  import torch
label_desc: Use image node_id 2 for calling the TransformerGeneratorAgent obj's underlying member method code with example usage: obj.build_model(states) and returns: model