class_docstr: Tests various generation functionalities.
  
  NOTE: Currently incomplete.
class_docstr_tok: ["Tests","various","generation","functionalities",".","NOTE",":","Currently","incomplete","."]
docstr: Test functionality of `get_prefix_tokens`.
docstr_tok: ["Test","functionality","of","`","get_prefix_tokens","`","."]
code: def test_prefix_tokens(self):
      """
      Test functionality of `get_prefix_tokens`.
      """
      args = [
          "--model-file",
          "zoo:unittest/transformer_generator2/model",
          "--model",
          "test_agents/transformer_generator_prefix",
          "--inference",
          "beam",
          "--truncate",
          "1024",
          "--beam-size",
          "2",
      ]
      pp = ParlaiParser(True, True)
      agent = create_agent(pp.parse_args(args), True)
      obs = {"text": "1 2 3 4 " * 256, "episode_done": False}
      agent.observe(obs)
      act = agent.act()
      beam_texts = [x[0] for x in act["beam_texts"]]
      for beam in beam_texts:
          # check that all beams start with the prefix text
          assert beam.startswith(
              PREFIX_TEXT
          ), f"[{beam}] does not start with [{PREFIX_TEXT}]"
  
imports: import unittest
  import math
  import torch
  from parlai.core.agents import create_agent
  from parlai.core.dict import DictionaryAgent
  import parlai.utils.testing
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_generator_agent import BeamSearch, GreedySearch, NucleusSampling, FactualNucleusSampling, TopKSampling, TorchGeneratorAgent
  from parlai.agents.test_agents.transformer_generator_prefix import PREFIX_TEXT
label_desc: Use image node_id 2 for calling the TestGeneration obj's underlying member method code with example usage: obj.test_prefix_tokens() without return types