code: def default_load_dataset(
      data_config_input: Union[Dict, utils.AttrDict],
  ) -> Union[
      hf_datasets.Dataset,
      hf_datasets.IterableDataset,
      hf_datasets.DatasetDict,
      hf_datasets.IterableDatasetDict,
  ]:
      """
      Creates the dataset using HuggingFace datasets' load_dataset method.
      If a dataset_name is provided, we will use that along with the dataset_config_name.
      Otherwise, we will create the dataset using provided train_file and validation_file.
  
      Args:
          data_config: arguments for load_dataset.  See DatasetKwargs for expected fields.
      Returns:
          Dataset returned from hf_datasets.load_dataset.
      """
      (data_config,) = hf_parse.parse_dict_to_dataclasses(
          (hf_parse.DatasetKwargs,), data_config_input
      )
      # This method is common in nearly all main HF examples.
      if data_config.dataset_name is not None:
          # Downloading and loading a dataset from the hub.
          datasets = hf_datasets.load_dataset(
              data_config.dataset_name, data_config.dataset_config_name
          )
          assert hasattr(
              datasets, "keys"
          ), "Expected a dictionary of datasets."
          datasets = cast(
              Union[
                  hf_datasets.DatasetDict,
                  hf_datasets.IterableDatasetDict,
              ],
              datasets,
          )
  
          if "validation" not in datasets.keys():
              assert (
                  "validation_split_percentage" in data_config
              ), "Validation split not provided by this huggingface dataset. Please specify "
              "validation_split_percentage in data_config for use to create validation set"
              datasets["validation"] = hf_datasets.load_dataset(
                  data_config.dataset_name,
                  data_config.dataset_config_name,
                  split=f"train[:{data_config.validation_split_percentage}%]",
              )
              datasets["train"] = hf_datasets.load_dataset(
                  data_config.dataset_name,
                  data_config.dataset_config_name,
                  split=f"train[{data_config.validation_split_percentage}%:]",
              )
      else:
          data_files = {}
          if data_config.train_file is not None:
              data_files["train"] = data_config.train_file
          if data_config.validation_file is not None:
              data_files["validation"] = data_config.validation_file
          extension = data_config.train_file.split(".")[-1]
          if extension == "txt":
              extension = "text"
          datasets = hf_datasets.load_dataset(
              extension, data_files=data_files
          )
      return datasets
  
file_path: determined/model_hub/model_hub/huggingface/_trial.py
imports: import dataclasses
  import logging
  from typing import Any, Dict, List, Optional, Tuple, Union, cast
  import datasets
  import torch
  import transformers
  import transformers.optimization
  import determined.pytorch
  from model_hub import utils
  from model_hub.huggingface import _config_parser
label_desc: Use image node_id 5 for calling a global function with example usage: default_load_dataset(data_config_input) and returns: datasets