



"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


_UpperCAmelCase  =      {
    """configuration_tapas""": ["""TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TapasConfig"""],
    """tokenization_tapas""": ["""TapasTokenizer"""],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCAmelCase  =      [
       """TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """TapasForMaskedLM""",
       """TapasForQuestionAnswering""",
       """TapasForSequenceClassification""",
       """TapasModel""",
       """TapasPreTrainedModel""",
       """load_tf_weights_in_tapas""",
   ]
try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCAmelCase  =      [
       """TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """TFTapasForMaskedLM""",
       """TFTapasForQuestionAnswering""",
       """TFTapasForSequenceClassification""",
       """TFTapasModel""",
       """TFTapasPreTrainedModel""",
   ]


if TYPE_CHECKING:
   from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
   from .tokenization_tapas import TapasTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tapas import (
          TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
          TapasForMaskedLM,
          TapasForQuestionAnswering,
          TapasForSequenceClassification,
          TapasModel,
          TapasPreTrainedModel,
          load_tf_weights_in_tapas,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_tapas import (
          TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFTapasForMaskedLM,
          TFTapasForQuestionAnswering,
          TFTapasForSequenceClassification,
          TFTapasModel,
          TFTapasPreTrainedModel,
      )


else:
   import sys

   _UpperCAmelCase  =      _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)







from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader




class A    (  UpperCamelCase_	):






      def __init__(   self		:	Union[str, Any]     ,  lowercase_		:	NestedDataStructureLike[PathLike]     ,  lowercase_		:	Optional[NamedSplit] = None     ,  lowercase_		:	Optional[Features] = None     ,  lowercase_		:	str = None     ,  lowercase_		:	bool = False     ,  lowercase_		:	bool = False     ,  lowercase_		:	Optional[int] = None     ,  **lowercase_		:	Optional[int]     ,  )   ->		Union[str, Any]:
             """simple docstring"""




             super().__init__(
                 lowercase_     ,  split=lowercase_     ,  features=lowercase_     ,  cache_dir=lowercase_     ,  keep_in_memory=lowercase_     ,  streaming=lowercase_     ,  num_proc=lowercase_     ,  **lowercase_     ,  )
             _lowerCamelCase			:						Optional[int]            =path_or_paths if isinstance(lowercase_     ,  lowercase_					) else {self.split: path_or_paths}
             _lowerCamelCase			:						int            =Text(
                 cache_dir=lowercase_     ,  data_files=lowercase_     ,  features=lowercase_     ,  **lowercase_     ,  )






      def 			lowerCamelCase			(   self		:	Optional[Any]					)   ->		Dict:
             """simple docstring"""




             if self.streaming:
                    _lowerCamelCase			:						Optional[Any]            =self.builder.as_streaming_dataset(split=self.split					)
             # Build regular (map-style) dataset
             else:
                    _lowerCamelCase			:						List[str]            =None
                    _lowerCamelCase			:						int            =None
                    _lowerCamelCase			:						Optional[Any]            =None
                    _lowerCamelCase			:						Any            =None

                    self.builder.download_and_prepare(
                        download_config=lowercase_     ,  download_mode=lowercase_     ,  verification_mode=lowercase_     ,  base_path=lowercase_     ,  num_proc=self.num_proc     ,  )
                    _lowerCamelCase			:						Tuple            =self.builder.as_dataset(
                        split=self.split     ,  verification_mode=lowercase_     ,  in_memory=self.keep_in_memory					)
             return dataset


