




"""simple docstring"""


from typing import TYPE_CHECKING

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


A_						=				{
    '''configuration_bridgetower''': [
        '''BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BridgeTowerConfig''',
        '''BridgeTowerTextConfig''',
        '''BridgeTowerVisionConfig''',
    ],
    '''processing_bridgetower''': ['''BridgeTowerProcessor'''],
}

try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_						=				['''BridgeTowerImageProcessor''']

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_						=				[
         '''BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''BridgeTowerForContrastiveLearning''',
         '''BridgeTowerForImageAndTextRetrieval''',
         '''BridgeTowerForMaskedLM''',
         '''BridgeTowerModel''',
         '''BridgeTowerPreTrainedModel''',
     ]


if TYPE_CHECKING:
     from .configuration_bridgetower import (
         BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP,
         BridgeTowerConfig,
         BridgeTowerTextConfig,
         BridgeTowerVisionConfig,
     )
     from .processing_bridgetower import BridgeTowerProcessor

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .image_processing_bridgetower import BridgeTowerImageProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_bridgetower import (
              BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST,
              BridgeTowerForContrastiveLearning,
              BridgeTowerForImageAndTextRetrieval,
              BridgeTowerForMaskedLM,
              BridgeTowerModel,
              BridgeTowerPreTrainedModel,
          )


else:
     import sys

     A_						=				_LazyModule(__name__, globals()['''__file__'''], _import_structure)










from typing import Optional

import pyspark

from .. import Features, NamedSplit
from ..download import DownloadMode
from ..packaged_modules.spark.spark import Spark
from .abc import AbstractDatasetReader
class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				def __init__(     self						:    Dict,  lowerCamelCase						:    pyspark.sql.DataFrame,  lowerCamelCase						:    Optional[NamedSplit] = None,  lowerCamelCase						:    Optional[Features] = None,  lowerCamelCase						:    bool = True,  lowerCamelCase						:    str = None,  lowerCamelCase						:    bool = False,  lowerCamelCase						:    str = None,  lowerCamelCase						:    bool = True,  lowerCamelCase						:    str = "arrow",  **lowerCamelCase						:    str,  ):

								'''simple docstring'''
								super().__init__(
								    split=lowerCamelCase,  features=lowerCamelCase,  cache_dir=lowerCamelCase,  keep_in_memory=lowerCamelCase,  streaming=lowerCamelCase,  **lowerCamelCase,  )
								lowercase__    =			load_from_cache_file
								lowercase__    =			file_format
								lowercase__    =			Spark(
								    df=lowerCamelCase,  features=lowerCamelCase,  cache_dir=lowerCamelCase,  working_dir=lowerCamelCase,  **lowerCamelCase,  )




				def 				lowercase__   (     self						:    List[Any]  ):

								'''simple docstring'''
								if self.streaming:
												return self.builder.as_streaming_dataset(split=self.split  )
								lowercase__    =			None if self._load_from_cache_file else DownloadMode.FORCE_REDOWNLOAD
								self.builder.download_and_prepare(
								    download_mode=lowerCamelCase,  file_format=self._file_format,  )
								return self.builder.as_dataset(split=self.split  )




