class_docstr: Loader class for dataset collections.
  
  Attributes:
    collection: the DatasetCollection to load.
    requested_version: optional version of the dataset collection to load. If
      none given, the latest version will be loaded.
    loader_kwargs: optional kwargs for the `tfds.load` function.
    datasets: initialized post-init, defines the datasets comprised in the
      requested dataset collection.
    collection_name: the name of the DatasetCollection to load.
class_docstr_tok: ["Loader","class","for","dataset","collections",".","Attributes",":","collection",":","the","DatasetCollection","to","load",".","requested_version",":","optional","version","of","the","dataset","collection","to","load",".","If","none","given",",","the","latest","version","will","be","loaded",".","loader_kwargs",":","optional","kwargs","for","the","`","tfds.load","`","function",".","datasets",":","initialized","post-init",",","defines","the","datasets","comprised","in","the","requested","dataset","collection",".","collection_name",":","the","name","of","the","DatasetCollection","to","load","."]
docstr: Loads the named dataset from a dataset collection by calling `tfds.load`.
  
  Args:
    dataset: `str`, the dataset name to load.
    split: which split(s) of the dataset to load. If `None`, will return all
      splits available for the dataset.
    loader_kwargs: `dict` (optional), keyword arguments to be passed to the
      `tfds.load` function. Refer to `tfds.load` documentation for a
      comperehensive overview of the different loading options.
  
  Returns:
    A `dict` of {`str`: tf.data.Dataset} for the desided dataset.
  
  Raises:
    KeyError: if trying to load a dataset not included in the collection.
    RuntimeError: if `load` return type is not a `dict` or a `list`.
code: def load_dataset(
      self,
      dataset: str,
      split: Optional[Tree[splits_lib.SplitArg]] = None,
      loader_kwargs: Optional[Dict[str, Any]] = None,
  ) -> Mapping[str, tf.data.Dataset]:
      """Loads the named dataset from a dataset collection by calling `tfds.load`.
  
      Args:
        dataset: `str`, the dataset name to load.
        split: which split(s) of the dataset to load. If `None`, will return all
          splits available for the dataset.
        loader_kwargs: `dict` (optional), keyword arguments to be passed to the
          `tfds.load` function. Refer to `tfds.load` documentation for a
          comperehensive overview of the different loading options.
  
      Returns:
        A `dict` of {`str`: tf.data.Dataset} for the desided dataset.
  
      Raises:
        KeyError: if trying to load a dataset not included in the collection.
        RuntimeError: if `load` return type is not a `dict` or a `list`.
      """
      if not dataset:
          raise TypeError(
              "You must specify a non-empty dataset to load."
          )
  
      loader_kwargs = loader_kwargs or self.loader_kwargs or {}
  
      # with_info must be False (or it will change the return type of `tfds.load`)
      if "with_info" in loader_kwargs and loader_kwargs["with_info"]:
          logging.warning(
              "`with_info` cannot be True, setting it to False"
          )
      loader_kwargs["with_info"] = False
  
      try:
          dataset_reference = self.datasets[dataset]
      except KeyError as e:
          raise KeyError(
              f"Dataset {dataset} is not included in this collection. "
              f"{self.collection.list_datasets(version=self.requested_version)}"
          ) from e
  
      # If `split` is defined both as argument and in `loader_kwargs`, always keep
      # the one defined as argument.
      if split:
          loader_kwargs["split"] = dataset_reference.get_split(split)
      # Make sure we always return a dict of dicts.
      if "split" in loader_kwargs and isinstance(
          loader_kwargs["split"], str
      ):
          loader_kwargs["split"] = [loader_kwargs["split"]]
  
      # Add the data dir from the reference to loader_kwargs if it is defined and
      # not overridden in loader_kwargs.
      if (
          dataset_reference.data_dir is not None
          and "data_dir" not in loader_kwargs
      ):
          loader_kwargs["data_dir"] = dataset_reference.data_dir
  
      load_output = load(dataset_reference.tfds_name(), **loader_kwargs)
      loaded_datasets = {}
      # If `split` is not specified, then `load` returns a dict with the split as
      # the key.
      if isinstance(load_output, dict):
          loaded_datasets = load_output
      # If `split` is a list, then the return type of `load` is a list of datasets
      # in the same order of the splits.
      elif isinstance(load_output, list):
          for split_name, d in zip(loader_kwargs["split"], load_output):
              assert isinstance(split_name, str)
              if isinstance(d, tuple):
                  ds, _ = d
                  loaded_datasets[split_name] = ds
              elif isinstance(d, tf.data.Dataset):
                  loaded_datasets[split_name] = d
              else:
                  raise RuntimeError(
                      f"Unsupported return type {type(load_output)} of `load` function."
                  )
      else:
          raise RuntimeError(
              f"Unsupported return type {type(load_output)} of `load` function."
          )
      return loaded_datasets
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import dataclasses
  import difflib
  import json
  import os
  import posixpath
  import re
  import textwrap
  import typing
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Type, Union
  from absl import logging
  from tensorflow_datasets.core import community
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_collection_builder
  from tensorflow_datasets.core import decode
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import logging
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import read_only_builder
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core import visibility
  from tensorflow_datasets.core.dataset_builders import huggingface_dataset_builder
  from tensorflow_datasets.core.utils import error_utils
  from tensorflow_datasets.core.utils import gcs_utils
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import read_config
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils import version
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 7 for calling the DatasetCollectionLoader obj's underlying member method code with example usage: obj.load_dataset(dataset, split, loader_kwargs) and returns: loaded_datasets