code: def main(_):
      tf.logging.set_verbosity(tf.logging.INFO)
      trainer_lib.set_random_seed(FLAGS.random_seed)
      usr_dir.import_usr_dir(FLAGS.t2t_usr_dir)
  
      if FLAGS.score_file:
          filename = os.path.expanduser(FLAGS.score_file)
          if not tf.gfile.Exists(filename):
              raise ValueError(
                  "The file to score doesn't exist: %s" % filename
              )
          results = score_file(filename)
          if not FLAGS.decode_to_file:
              raise ValueError(
                  "To score a file, specify --decode_to_file for results."
              )
          write_file = tf.gfile.Open(
              os.path.expanduser(FLAGS.decode_to_file), "w"
          )
          for score in results:
              write_file.write("%.6f\n" % score)
          write_file.close()
          return
  
      hp = create_hparams()
      decode_hp = create_decode_hparams()
      run_config = t2t_trainer.create_run_config(hp)
      if FLAGS.disable_grappler_optimizations:
          run_config.session_config.graph_options.rewrite_options.disable_meta_optimizer = (
              True
          )
  
      # summary-hook in tf.estimator.EstimatorSpec requires
      # hparams.model_dir to be set.
      hp.add_hparam("model_dir", run_config.model_dir)
  
      estimator = trainer_lib.create_estimator(
          FLAGS.model,
          hp,
          run_config,
          decode_hparams=decode_hp,
          use_tpu=FLAGS.use_tpu,
      )
  
      decode(estimator, hp, decode_hp)
  
file_path: tensor2tensor/tensor2tensor/bin/t2t_decoder.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  from tensor2tensor.utils import usr_dir
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling a global function with example usage: main(_) without return types