class_docstr: Benchmark return tests for CQL-SAC Kumar20.
class_docstr_tok: ["Benchmark","return","tests","for","CQL-SAC","Kumar20","."]
docstr: Benchmarks MuJoCo HalfCheetah to 1M steps.
docstr_tok: ["Benchmarks","MuJoCo","HalfCheetah","to","1M","steps","."]
code: def benchmark_halfcheetah_medium_v0(self):
      """Benchmarks MuJoCo HalfCheetah to 1M steps."""
      self.setUp()
      output_dir = self._get_test_output_dir(
          "halfcheetah_medium_v0_02_eval"
      )
      start_time_sec = time.time()
      gin.parse_config_file(
          "tf_agents/examples/cql_sac/kumar20/configs/mujoco_medium.gin"
      )
      cql_sac_train_eval.train_eval(
          root_dir=output_dir,
          env_name="halfcheetah-medium-v0",
          dataset_name="d4rl_mujoco_halfcheetah/v0-medium",
          num_gradient_updates=500000,  # Number of iterations.
          learner_iterations_per_call=500,
          data_shuffle_buffer_size=10000,
          data_num_shards=50,
          data_parallel_reads=500,
          data_prefetch=1000000,
          eval_interval=10000,
      )
      wall_time_sec = time.time() - start_time_sec
      event_file = utils.find_event_log(
          os.path.join(output_dir, "eval")
      )
      values, _ = utils.extract_event_log_values(
          event_file, "Metrics/AverageReturn", start_step=10000
      )
  
      # Min/Max ranges are very large to only hard fail if very broken. The system
      # monitoring the results owns looking for anomalies. These numbers are based
      # on the results that we were getting in MLCompass as of 04-NOV-2021.
      # Results at 500k steps and 1M steps are similar enough to not make it worth
      # running 1M.
      metric_500k = self.build_metric(
          "average_return_at_env_step500000",
          values[500000],
          min_value=4400,
          max_value=5400,
      )
  
      self.report_benchmark(
          wall_time=wall_time_sec, metrics=[metric_500k], extras={}
      )
  
file_path: agents/tf_agents/benchmark/cql_sac_benchmark.py
imports: import os
  import time
  from absl import logging
  import gin
  import tensorflow
  from tf_agents.benchmark import utils
  from tf_agents.benchmark.perfzero_benchmark import PerfZeroBenchmark
  from tf_agents.examples.cql_sac.kumar20 import cql_sac_train_eval
label_desc: Use image node_id 2 for calling the CqlSacKumar20Return obj's underlying member method code with example usage: obj.benchmark_halfcheetah_medium_v0() without return types