class_docstr: Evaluates an instance.
class_docstr_tok: ["Evaluates","an","instance","."]
code: def process(self, request_state_set: RequestStateSet) -> List[Stat]:
      instance_stats: List[Stat] = []
  
      # Evaluate generated request_state
      generation_states = request_state_set.generation_states
      if len(generation_states) != 0:
          instance_stats.extend(
              self.metric.evaluate_generation(
                  self.adapter_spec,
                  singleton(generation_states),
                  self.metric_service,
                  self.eval_cache_path,
              )
          )
  
      # Evaluate the references
      references_states = request_state_set.references_states
      if len(references_states) != 0:
          instance_stats.extend(
              self.metric.evaluate_references(
                  self.adapter_spec,
                  references_states,
                  self.metric_service,
                  self.eval_cache_path,
              )
          )
  
      # Add instance-related context (e.g., split, perturbation) to the metrics
      for i, stat in enumerate(instance_stats):
          instance_stats[i] = add_context(
              stat,
              MetricContext.from_instance(request_state_set.instance),
          )
  
      return instance_stats
  
imports: from abc import ABC
  from dataclasses import dataclass, replace
  from collections import defaultdict
  from typing import List, Dict, Tuple, Optional, Iterable, Set
  from helm.common.object_spec import ObjectSpec, create_object
  from helm.common.general import singleton, parallel_map
  from helm.benchmark.augmentations.perturbation_description import PerturbationDescription, PERTURBATION_ORIGINAL, PERTURBATION_WORST
  from helm.benchmark.adaptation.adapters.adapter_factory import ADAPT_LANGUAGE_MODELING
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.benchmark.scenarios.scenario import Instance
  from .metric_name import MetricName, MetricContext
  from .metric_service import MetricService
  from .statistic import Stat, merge_stat
label_desc: Use image node_id 1 for calling the Processor obj's underlying member method code with example usage: obj.process(request_state_set) and returns: instance_stats