code: def generate_configurations(path: Path) -> List[Any]:
      """
      Generates the hyperparameter configuration for the configuration(s) found
      at the specified path.
  
      Args:
          path: Either a file or directory from to read the configuration(s). If a directory is
              given, all YAML files are read recursively.
  
      Returns:
          The configurations.
      """
      if path.is_file():
          with path.open() as f:
              return _generate_configurations(f)
  
      all_configurations = []
      for file in path.glob("**/*.yaml"):
          with file.open() as f:
              all_configurations.extend(_generate_configurations(f))
      return all_configurations
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/cli/utils/config.py
imports: import itertools
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterator, List, Literal, TextIO
  import yaml
  from tsbench.config import TrainConfig
label_desc: Use image node_id 2 for calling a global function with example usage: generate_configurations(path) and returns: all_configurations, _generate_configurations