code: def main(_):
      problem = registry.problem(FLAGS.problem)
  
      # We make the assumption that the problem is a subclass of Text2TextProblem.
      assert isinstance(problem, text_problems.Text2TextProblem)
  
      data_dir = os.path.expanduser(FLAGS.data_dir)
      tmp_dir = os.path.expanduser(FLAGS.tmp_dir)
  
      tf.gfile.MakeDirs(data_dir)
      tf.gfile.MakeDirs(tmp_dir)
  
      tf.logging.info("Saving vocabulary to data_dir: %s" % data_dir)
  
      problem.get_or_create_vocab(data_dir, tmp_dir)
  
      tf.logging.info(
          "Saved vocabulary file: "
          + os.path.join(data_dir, problem.vocab_filename)
      )
  
file_path: tensor2tensor/tensor2tensor/bin/build_vocab.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from tensor2tensor import problems
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: main(_) without return types