


'''simple docstring'''







from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream
class 	UpperCamelCase__					( SCREAMING_SNAKE_CASE_	):



     """simple docstring"""






     def __init__( self      ,	snake_case__      ,	snake_case__ = None      ,	snake_case__ = None      ,	snake_case__ = False      ,	snake_case__ = False      ,	snake_case__ = None      ,	snake_case__ = None      ,	**snake_case__      ,	):

            '''simple docstring'''

            super().__init__(
                features=snake_case__      ,	cache_dir=snake_case__      ,	keep_in_memory=snake_case__      ,	streaming=snake_case__      ,	num_proc=snake_case__      ,	**snake_case__      ,	)
            _lowerCAmelCase    :							int   			=       Generator(
                cache_dir=snake_case__      ,	features=snake_case__      ,	generator=snake_case__      ,	gen_kwargs=snake_case__      ,	**snake_case__      ,	)







     def a	( self   ):

            '''simple docstring'''

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

                   self.builder.download_and_prepare(
                       download_config=snake_case__      ,	download_mode=snake_case__      ,	verification_mode=snake_case__      ,	base_path=snake_case__      ,	num_proc=self.num_proc      ,	)
                   _lowerCAmelCase    :							Optional[Any]   			=       self.builder.as_dataset(
                       split='train'      ,	verification_mode=snake_case__      ,	in_memory=self.keep_in_memory   )
            return dataset





'''simple docstring'''







from typing import TYPE_CHECKING

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


lowerCAmelCase    :     int					=						{
    """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig"""],
    """processing_trocr""": ["""TrOCRProcessor"""],
}


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       lowerCAmelCase    :     Optional[Any]					=						[
           """TROCR_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """TrOCRForCausalLM""",
           """TrOCRPreTrainedModel""",
       ]


if TYPE_CHECKING:
       from .configuration_trocr import TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP, TrOCRConfig
       from .processing_trocr import TrOCRProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_trocr import TROCR_PRETRAINED_MODEL_ARCHIVE_LIST, TrOCRForCausalLM, TrOCRPreTrainedModel

else:
       import sys

       lowerCAmelCase    :     Any					=						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

