code: def main(_):
      now = datetime.datetime.now()
      now_tag = now.strftime("%Y_%m_%d_%H_%M")
      loop_hparams = trainer_lib.create_hparams(
          FLAGS.loop_hparams_set, FLAGS.loop_hparams
      )
      if FLAGS.worker_to_game_map and FLAGS.total_num_workers > 1:
          loop_hparams.game = get_game_for_worker(
              FLAGS.worker_to_game_map, FLAGS.worker_id + 1
          )
          tf.logging.info("Set game to %s." % loop_hparams.game)
      loop_hparams.eval_rl_env_max_episode_steps = FLAGS.eval_step_limit
      loop_hparams.eval_batch_size = FLAGS.eval_batch_size
      planner_hparams = trainer_lib.create_hparams(
          FLAGS.planner_hparams_set, FLAGS.planner_hparams
      )
      policy_dir = FLAGS.policy_dir
      model_dir = FLAGS.model_dir
      eval_metrics_dir = FLAGS.eval_metrics_dir
      debug_video_path = FLAGS.debug_video_path
      evaluate_fn = evaluate
      if FLAGS.output_dir:
          cur_dir = FLAGS.output_dir
          if FLAGS.total_num_workers > 1:
              cur_dir = os.path.join(
                  cur_dir, "%d" % (FLAGS.worker_id + 1)
              )
          policy_dir = os.path.join(cur_dir, "policy")
          model_dir = os.path.join(cur_dir, "world_model")
          eval_dir_basename = "evaluator_"
          if FLAGS.agent == "planner":
              eval_dir_basename = FLAGS.planner_hparams_set + "_"
          eval_metrics_dir = os.path.join(
              cur_dir, eval_dir_basename + now_tag
          )
          debug_video_path = eval_metrics_dir
          tf.logging.info("Writing metrics to %s." % eval_metrics_dir)
          if not tf.gfile.Exists(eval_metrics_dir):
              tf.gfile.MkDir(eval_metrics_dir)
          if FLAGS.all_epochs:
              evaluate_fn = evaluate_all_epochs
      evaluate_fn(
          loop_hparams,
          planner_hparams,
          policy_dir,
          model_dir,
          eval_metrics_dir,
          FLAGS.agent,
          FLAGS.mode,
          FLAGS.eval_with_learner,
          FLAGS.log_every_steps if FLAGS.log_every_steps > 0 else None,
          debug_video_path=debug_video_path,
          num_debug_videos=FLAGS.num_debug_videos,
          random_starts_step_limit=FLAGS.random_starts_step_limit,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import datetime
  import os
  from tensor2tensor.data_generators import gym_env
  from tensor2tensor.layers import common_video
  from tensor2tensor.models.research import rl
  from tensor2tensor.rl import rl_utils
  from tensor2tensor.rl import trainer_model_based_params
  from tensor2tensor.utils import flags
  from tensor2tensor.utils import hparam
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
label_desc: Use image node_id 23 for calling a global function with example usage: main(_) without return types