code: def _load_hf_datasets(
      dataset: Optional[Union[str, DataFrame]],
      training_set: Optional[Union[str, DataFrame]],
      validation_set: Optional[Union[str, DataFrame]],
      test_set: Optional[Union[str, DataFrame]],
      backend: Backend,
  ) -> Tuple[
      Optional[CacheableDataframe],
      Optional[CacheableDataframe],
      Optional[CacheableDataframe],
      Optional[CacheableDataframe],
  ]:
      """Loads and returns any Hugging Face datasets as CacheableDataframes.
  
      Returns the input unmodified for any non-HF datasets.
      """
      dataset_out = dataset
      training_set_out = training_set
      validation_set_out = validation_set
      test_set_out = test_set
  
      # Check that any of the datasets begin with the `hf://` prefix denoting a Hugging Face dataset URI
      # Hugging Face datasets should follow the naming convention `hf://<hf_id>--<hf_subsample>`
      if dataset is not None:
          if isinstance(dataset, str) and dataset.startswith(HF_PREFIX):
              dataset_out = _load_cacheable_hf_dataset(dataset, backend)
          return (
              dataset_out,
              training_set_out,
              validation_set_out,
              test_set_out,
          )
  
      # Because of the conditional logic (_is_hf) in load_dataset_uris, if the above block is not triggered, then
      # training_set must be a string that starts with HF_PREFIX
      train_df = test_df = val_df = None
      loader = get_dataset("hugging_face")
      hf_id, hf_subsample = _get_hf_dataset_and_subsample(training_set)
      train_df, val_df, test_df = loader.load(
          hf_id, hf_subsample, split=True
      )  # Call hugging_face loader
      train_df = backend.df_engine.from_pandas(train_df)
      training_set_out = CacheableDataframe(
          df=train_df, name=training_set, checksum=None
      )
  
      if isinstance(validation_set, str) and validation_set.startswith(
          HF_PREFIX
      ):
          if validation_set == training_set:
              # Reuse the loaded DF from the training split
              val_df = backend.df_engine.from_pandas(val_df)
              validation_set_out = CacheableDataframe(
                  df=val_df, name=validation_set, checksum=None
              )
          else:  # This handles an edge case -- NOT EXPECTED USER BEHAVIOR
              logging.warn(
                  "A Hugging Face validation set has been passed in that is different from the test set. "
                  "This is not recommended."
              )
              validation_set_out = _load_cacheable_hf_dataset(
                  validation_set, backend, split_set=VALIDATION
              )
  
      if isinstance(test_set, str) and test_set.startswith(HF_PREFIX):
          if test_set == training_set:
              # Reuse the loaded DF from the training split
              test_df = backend.df_engine.from_pandas(test_df)
              test_set_out = CacheableDataframe(
                  df=test_df, name=test_set, checksum=None
              )
          else:  # This handles an edge case -- NOT EXPECTED USER BEHAVIOR
              logging.warn(
                  "A Hugging Face test set has been passed in that is different from the training set. "
                  "This is not recommended."
              )
              test_set_out = _load_cacheable_hf_dataset(
                  test_set, backend, split_set=TEST
              )
  
      return (
          dataset_out,
          training_set_out,
          validation_set_out,
          test_set_out,
      )
  
imports: import argparse
  import importlib
  import logging
  import os
  from collections import OrderedDict
  from functools import lru_cache
  from io import BytesIO
  from typing import Any, Dict, List, Literal, Optional, Tuple, Union
  import yaml
  from ludwig.api_annotations import DeveloperAPI, PublicAPI
  from ludwig.backend.base import Backend
  from ludwig.constants import AUDIO, BINARY, CATEGORY, IMAGE, NUMBER, TEST, TEXT, TRAIN, TYPE, VALIDATION
  from ludwig.data.cache.types import CacheableDataframe
  from ludwig.datasets import configs
  from ludwig.datasets.dataset_config import DatasetConfig
  from ludwig.datasets.loaders.dataset_loader import DatasetLoader
  from ludwig.datasets.utils import model_configs_for_dataset
  from ludwig.globals import LUDWIG_VERSION
  from ludwig.utils.print_utils import print_ludwig
  from ludwig.utils.types import DataFrame
label_desc: Use image node_id 7 for calling a global function with example usage: _load_hf_datasets(dataset, training_set, validation_set, test_set, backend) and returns: dataset_out,  training_set_out,  validation_set_out,  test_set_out, dataset_out,  training_set_out,  validation_set_out,  test_set_out