code: def run_entries_to_run_specs(
      run_entries: List[RunEntry],
      max_eval_instances: Optional[int] = None,
      num_train_trials: Optional[int] = None,
      models_to_run: Optional[List[str]] = None,
      groups_to_run: Optional[List[str]] = None,
      priority: Optional[int] = None,
  ) -> List[RunSpec]:
      """Runs RunSpecs given a list of RunSpec descriptions."""
      run_specs: List[RunSpec] = []
      for entry in run_entries:
          # Filter by priority
          if priority is not None and entry.priority > priority:
              continue
  
          for run_spec in construct_run_specs(
              parse_object_spec(entry.description)
          ):
              # Filter by models
              if (
                  models_to_run
                  and run_spec.adapter_spec.model not in models_to_run
              ):
                  continue
  
              # Filter by groups
              if groups_to_run and not any(
                  group in groups_to_run for group in run_spec.groups
              ):
                  continue
  
              # Modify AdapterSpec
              adapter_spec: AdapterSpec = run_spec.adapter_spec
              if max_eval_instances is not None:
                  adapter_spec = replace(
                      adapter_spec,
                      max_eval_instances=max_eval_instances,
                  )
              if (
                  num_train_trials is not None
                  or adapter_spec.max_train_instances == 0
              ):
                  adapter_spec = replace(
                      adapter_spec,
                      num_train_trials=1
                      if adapter_spec.max_train_instances == 0
                      else num_train_trials,
                  )
              run_spec = replace(run_spec, adapter_spec=adapter_spec)
  
              # Append groups
              if entry.groups is not None:
                  groups_name: str = (
                      ""
                      if len(entry.groups) == 0
                      else f",groups={'-'.join(sorted(entry.groups))}"
                  )
                  run_spec = replace(
                      run_spec,
                      name=run_spec.name + groups_name,
                      groups=run_spec.groups + entry.groups,
                  )
  
              run_specs.append(run_spec)
  
      return run_specs
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/run.py
imports: import argparse
  from dataclasses import replace
  from typing import List, Optional
  from helm.benchmark.presentation.run_entry import RunEntry, read_run_entries
  from helm.common.hierarchical_logger import hlog, htrack, htrack_block
  from helm.common.authentication import Authentication
  from helm.common.object_spec import parse_object_spec
  from helm.proxy.clients.huggingface_model_registry import register_huggingface_model_config
  from helm.proxy.clients.remote_model_registry import check_and_register_remote_model
  from helm.proxy.services.remote_service import create_authentication, add_service_args
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from .executor import ExecutionSpec
  from .runner import Runner, RunSpec, LATEST_SYMLINK
  from .run_specs import construct_run_specs
label_desc: Use image node_id 1 for calling a global function with example usage: run_entries_to_run_specs(run_entries, max_eval_instances, num_train_trials, models_to_run, groups_to_run, priority) and returns: run_specs