class_docstr: Metrics for dry run.
class_docstr_tok: ["Metrics","for","dry","run","."]
docstr: Add up all the estimated number of tokens used for each request.
docstr_tok: ["Add","up","all","the","estimated","number","of","tokens","used","for","each","request","."]
code: def evaluate(
      self,
      scenario_state: ScenarioState,
      metric_service: MetricService,
      eval_cache_path: str,
      parallelism: int,
  ) -> MetricResult:
      """
      Add up all the estimated number of tokens used for each request.
      """
      processor = Processor(
          token_cost_estimator=self.token_cost_estimator,
          metric_service=metric_service,
      )
      results: List[List[Stat]] = parallel_map(
          processor.process,
          scenario_state.request_states,
          parallelism=parallelism,
      )
  
      # Per-instance
      per_instance_stats = [
          PerInstanceStats(
              cast(str, request_state.instance.id),
              request_state.instance.perturbation,
              request_state.train_trial_index,
              stats,
          )
          for request_state, stats in zip(
              scenario_state.request_states, results
          )
      ]
  
      # Aggregate
      stats: Dict[MetricName, Stat] = {}
      for instance_stats in results:
          for stat in instance_stats:
              merge_stat(stats, stat)
  
      merge_stat(
          stats,
          Stat(MetricName("num_requests")).add(
              len(scenario_state.request_states)
          ),
      )
  
      return MetricResult(list(stats.values()), per_instance_stats)
  
imports: from typing import List, Dict, cast
  from dataclasses import dataclass
  from helm.common.general import parallel_map
  from helm.common.request import Request
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.metrics.statistic import Stat, merge_stat
  from helm.benchmark.window_services.window_service import WindowService
  from helm.benchmark.window_services.window_service_factory import WindowServiceFactory
  from .metric import Metric, MetricResult, PerInstanceStats
  from .metric_name import MetricName
  from .metric_service import MetricService
  from .tokens.auto_token_cost_estimator import AutoTokenCostEstimator
  from .tokens.token_cost_estimator import TokenCostEstimator
label_desc: Use image node_id 3 for calling the DryRunMetric obj's underlying member method code with example usage: obj.evaluate(scenario_state, metric_service, eval_cache_path, parallelism) and returns: MetricResult