class_docstr: Generic DatasetBuilder loading from a directory.
class_docstr_tok: ["Generic","DatasetBuilder","loading","from","a","directory","."]
docstr: Constructor.
  
  Args:
    builder_dir: Directory of the dataset to load (e.g.
      `~/tensorflow_datasets/mnist/3.0.0/`)
    info_proto: DatasetInfo describing the name, config, etc of the requested
      dataset. Note that this overwrites dataset info that may be present in
      builder_dir.
  
  Raises:
    FileNotFoundError: If the builder_dir does not exist.
docstr_tok: ["Constructor",".","Args",":","builder_dir",":","Directory","of","the","dataset","to","load","(","e.g",".","`","~\/tensorflow_datasets\/mnist\/3.0.0\/","`",")","info_proto",":","DatasetInfo","describing","the","name",",","config",",","etc","of","the","requested","dataset",".","Note","that","this","overwrites","dataset","info","that","may","be","present","in","builder_dir",".","Raises",":","FileNotFoundError",":","If","the","builder_dir","does","not","exist","."]
code: def __init__(
      self,
      builder_dir: epath.PathLike,
      *,
      info_proto: Optional[dataset_info_pb2.DatasetInfo] = None,
  ):
      """Constructor.
  
      Args:
        builder_dir: Directory of the dataset to load (e.g.
          `~/tensorflow_datasets/mnist/3.0.0/`)
        info_proto: DatasetInfo describing the name, config, etc of the requested
          dataset. Note that this overwrites dataset info that may be present in
          builder_dir.
  
      Raises:
        FileNotFoundError: If the builder_dir does not exist.
      """
      builder_dir = os.path.expanduser(builder_dir)
      if not info_proto:
          info_proto = dataset_info.read_proto_from_builder_dir(
              builder_dir
          )
      self._info_proto = info_proto
  
      self.name = info_proto.name
      self.VERSION = version_lib.Version(
          info_proto.version
      )  # pylint: disable=invalid-name
      self.RELEASE_NOTES = (
          info_proto.release_notes or {}
      )  # pylint: disable=invalid-name
  
      if info_proto.module_name:
          # Overwrite the module so documenting `ReadOnlyBuilder` point to the
          # original source code.
          self.__module__ = info_proto.module_name
  
      builder_config = dataset_builder.BuilderConfig.from_dataset_info(
          info_proto,
      )
      # __init__ will call _build_data_dir, _create_builder_config,
      # _pick_version to set the data_dir, config, and version
      super().__init__(
          data_dir=builder_dir,
          config=builder_config,
          version=info_proto.version,
      )
  
      # For pickling, should come after super.__init__ which is setting that same
      # _original_state attribute.
      self._original_state = dict(builder_dir=builder_dir)
  
      if self.info.features is None:
          raise ValueError(
              f"Cannot restore {self.info.full_name}. It likely means the dataset "
              "was generated with an old TFDS version (<=3.2.1)."
          )
  
imports: import functools
  import os
  import typing
  from typing import Any, List, Optional, Tuple, Type
  from etils import epath
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_info
  from tensorflow_datasets.core import logging
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.proto import dataset_info_pb2
  from tensorflow_datasets.core.utils import error_utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.core.utils import version
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 1 to create a new ReadOnlyBuilder object from inherited base classes: dataset_builder with example: obj = ReadOnlyBuilder(builder_dir)