code: def get_light_scenarios_from_run_spec(
      run_spec: RunSpec,
      scenario_download_path: str = "exported_scenarios",
  ) -> List[LightScenario]:
      """
      Create a list of LightInstances given a RunSpec. Only keep the text of the input and references.
      Note that one LightScenario object is created for each split of the Scenario for simplification.
      """
  
      scenario: Scenario = create_scenario(run_spec.scenario_spec)
  
      ensure_directory_exists(scenario_download_path)
      scenario.output_path = os.path.join(
          scenario_download_path, scenario.name
      )
      ensure_directory_exists(scenario.output_path)
  
      # Load instances
      instances: List[Instance]
      with htrack_block("scenario.get_instances"):
          instances = scenario.get_instances()
  
      # Classify instances into splits
      splits: List[str] = [TRAIN_SPLIT, VALID_SPLIT, TEST_SPLIT]
      split_mapping: DefaultDict[str, list] = defaultdict(list)
      for instance in instances:
          if instance.split is None or instance.split not in splits:
              raise ValueError(
                  f"split should be one of {TRAIN_SPLIT}, {VALID_SPLIT}, or {TEST_SPLIT}, but got {instance.split}"
              )
          split_mapping[instance.split].append(instance)
  
      # Convert Scenarios to LightScenarios
      light_scenarios: List[LightScenario] = []
      for split, instances in split_mapping.items():
          light_instances: List[LightInstance] = [
              create_light_instance_from_instance(instance)
              for instance in instances
          ]
          light_scenario = LightScenario(
              light_scenario_key=LightScenarioKey(
                  metadata={
                      "scenario_spec": run_spec.scenario_spec,
                      "split": split,
                  }
              ),
              light_instances=light_instances,
          )
          light_scenarios.append(light_scenario)
      return light_scenarios
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/contamination/export_scenario_text.py
imports: import json
  import os
  import argparse
  from typing import List, DefaultDict
  from collections import defaultdict
  from helm.common.general import asdict_without_nones, ensure_directory_exists
  from helm.common.hierarchical_logger import hlog, htrack_block
  from helm.benchmark.scenarios.scenario import Scenario, Instance, create_scenario, TRAIN_SPLIT, VALID_SPLIT, TEST_SPLIT
  from helm.benchmark.presentation.run_entry import read_run_entries
  from helm.benchmark.run import run_entries_to_run_specs
  from helm.benchmark.runner import RunSpec
  from helm.benchmark.contamination.light_scenario import LightInstance, LightScenario, LightScenarioKey
label_desc: Use image node_id 2 for calling a global function with example usage: get_light_scenarios_from_run_spec(run_spec, scenario_download_path) and returns: light_scenarios