





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


UpperCAmelCase     :     Dict							=	{
    """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """MegaOnnxConfig"""],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase     :     Optional[int]							=	[
         """MEGA_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """MegaForCausalLM""",
         """MegaForMaskedLM""",
         """MegaForMultipleChoice""",
         """MegaForQuestionAnswering""",
         """MegaForSequenceClassification""",
         """MegaForTokenClassification""",
         """MegaModel""",
         """MegaPreTrainedModel""",
     ]

if TYPE_CHECKING:
     from .configuration_mega import MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP, MegaConfig, MegaOnnxConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_mega import (
              MEGA_PRETRAINED_MODEL_ARCHIVE_LIST,
              MegaForCausalLM,
              MegaForMaskedLM,
              MegaForMultipleChoice,
              MegaForQuestionAnswering,
              MegaForSequenceClassification,
              MegaForTokenClassification,
              MegaModel,
              MegaPreTrainedModel,
          )

else:
     import sys

     UpperCAmelCase     :     Optional[int]							=	_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     __lowerCAmelCase	(   UpperCamelCase__):







      def __init__(   self		,				lowerCAmelCase__		,				lowerCAmelCase__ = None		,				lowerCAmelCase__ = None		,				lowerCAmelCase__ = None		,				lowerCAmelCase__ = False		,				lowerCAmelCase__ = False		,				lowerCAmelCase__ = None		,				**lowerCAmelCase__		,				)       ->						int:



        '''simple docstring'''




        super().__init__(
            lowerCAmelCase__		,				split=lowerCAmelCase__		,				features=lowerCAmelCase__		,				cache_dir=lowerCAmelCase__		,				keep_in_memory=lowerCAmelCase__		,				streaming=lowerCAmelCase__		,				num_proc=lowerCAmelCase__		,				**lowerCAmelCase__		,				)
        a__     : Tuple  =path_or_paths if isinstance(lowerCAmelCase__		,				lowerCAmelCase__							) else {self.split: path_or_paths}
        a__     : List[str]  =Text(
            cache_dir=lowerCAmelCase__		,				data_files=lowerCAmelCase__		,				features=lowerCAmelCase__		,				**lowerCAmelCase__		,				)







      def        _lowercase  (   self							)       ->						List[Any]:



        '''simple docstring'''




        if self.streaming:
          a__     : str  =self.builder.as_streaming_dataset(split=self.split							)
        # Build regular (map-style) dataset
        else:
          a__     : Dict  =None
          a__     : Optional[Any]  =None
          a__     : Union[str, Any]  =None
          a__     : Tuple  =None

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






