code: def _read_and_preprocess_human_eval(
      target_path: str,
      num_train_instances: int,
      num_val_instances: int,
      num_test_instances: int,
  ) -> List[CodeInstance]:
      problems = _read_human_eval(target_path)
      instances = []
      for sample_idx, task_id in enumerate(problems):
          if sample_idx < num_train_instances:
              split = TRAIN_SPLIT
          elif sample_idx < num_train_instances + num_val_instances:
              split = VALID_SPLIT
          else:
              split = TEST_SPLIT
  
          instance = CodeInstance(
              input=Input(text=problems[task_id]["prompt"]),
              references=[
                  CodeReference(
                      output=Output(
                          text=problems[task_id]["canonical_solution"]
                      ),
                      test_cases=problems[task_id],
                      tags=[CORRECT_TAG],
                  )
              ],
              split=split,
          )
          instances.append(instance)
      return instances
  
imports: import io
  import json
  import os
  from typing import List, Dict, Iterable, Optional, cast
  from helm.common.general import ensure_file_downloaded
  from helm.common.hierarchical_logger import hlog
  from .code_scenario_helper import run
  from .code_scenario_apps_pinned_file_order import apps_listdir_with_pinned_order
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, VALID_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 1 for calling a global function with example usage: _read_and_preprocess_human_eval(target_path, num_train_instances, num_val_instances, num_test_instances) and returns: instances