class_docstr: A QueryProcessor using a trained Transformer model.
  
  This processor supports the following visualizations:
    - processing: Basic source and target text processing
    - graph: A graph of the beam search process.
class_docstr_tok: ["A","QueryProcessor","using","a","trained","Transformer","model",".","This","processor","supports","the","following","visualizations",":","-","processing",":","Basic","source","and","target","text","processing","-","graph",":","A","graph","of","the","beam","search","process","."]
docstr: Creates the Transformer estimator.
  
  Args:
    processor_configuration: A ProcessorConfiguration protobuffer with the
      transformer fields populated.
docstr_tok: ["Creates","the","Transformer","estimator",".","Args",":","processor_configuration",":","A","ProcessorConfiguration","protobuffer","with","the","transformer","fields","populated","."]
code: def __init__(self, processor_configuration):
      """Creates the Transformer estimator.
  
      Args:
        processor_configuration: A ProcessorConfiguration protobuffer with the
          transformer fields populated.
      """
      # Do the pre-setup tensor2tensor requires for flags and configurations.
      transformer_config = processor_configuration["transformer"]
      FLAGS.output_dir = transformer_config["model_dir"]
      usr_dir.import_usr_dir(FLAGS.t2t_usr_dir)
      data_dir = os.path.expanduser(transformer_config["data_dir"])
  
      # Create the basic hyper parameters.
      self.hparams = trainer_lib.create_hparams(
          transformer_config["hparams_set"],
          transformer_config["hparams"],
          data_dir=data_dir,
          problem_name=transformer_config["problem"],
      )
  
      decode_hp = decoding.decode_hparams()
      decode_hp.add_hparam("shards", 1)
      decode_hp.add_hparam("shard_id", 0)
  
      # Create the estimator and final hyper parameters.
      self.estimator = trainer_lib.create_estimator(
          transformer_config["model"],
          self.hparams,
          t2t_trainer.create_run_config(self.hparams),
          decode_hparams=decode_hp,
          use_tpu=False,
      )
  
      # Fetch the vocabulary and other helpful variables for decoding.
      self.source_vocab = self.hparams.problem_hparams.vocabulary[
          "inputs"
      ]
      self.targets_vocab = self.hparams.problem_hparams.vocabulary[
          "targets"
      ]
      self.const_array_size = 10000
  
      # Prepare the Transformer's debug data directory.
      run_dirs = sorted(
          glob.glob(os.path.join("/tmp/t2t_server_dump", "run_*"))
      )
      for run_dir in run_dirs:
          shutil.rmtree(run_dir)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import deque
  import glob
  import os
  import shutil
  import time
  import numpy
  from six.moves import range
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.insights import graph
  from tensor2tensor.insights import query_processor
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import trainer_lib
  from tensor2tensor.utils import usr_dir
  import tensorflow.compat.v1
  from tensorflow.python import debug
label_desc: Use image node_id 1 to create a new TransformerModel object from inherited base classes: query_processor with example: obj = TransformerModel(processor_configuration)