




from typing import TYPE_CHECKING

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


UpperCAmelCase_									=	{
    'configuration_blip': [
        'BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'BlipConfig',
        'BlipTextConfig',
        'BlipVisionConfig',
    ],
    'processing_blip': ['BlipProcessor'],
}

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


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_									=	[
           'BLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
           'BlipModel',
           'BlipPreTrainedModel',
           'BlipForConditionalGeneration',
           'BlipForQuestionAnswering',
           'BlipVisionModel',
           'BlipTextModel',
           'BlipForImageTextRetrieval',
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_									=	[
           'TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
           'TFBlipModel',
           'TFBlipPreTrainedModel',
           'TFBlipForConditionalGeneration',
           'TFBlipForQuestionAnswering',
           'TFBlipVisionModel',
           'TFBlipTextModel',
           'TFBlipForImageTextRetrieval',
       ]

if TYPE_CHECKING:
       from .configuration_blip import BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP, BlipConfig, BlipTextConfig, BlipVisionConfig
       from .processing_blip import BlipProcessor

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .image_processing_blip import BlipImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_blip import (
                  BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  BlipForConditionalGeneration,
                  BlipForImageTextRetrieval,
                  BlipForQuestionAnswering,
                  BlipModel,
                  BlipPreTrainedModel,
                  BlipTextModel,
                  BlipVisionModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_blip import (
                  TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFBlipForConditionalGeneration,
                  TFBlipForImageTextRetrieval,
                  TFBlipForQuestionAnswering,
                  TFBlipModel,
                  TFBlipPreTrainedModel,
                  TFBlipTextModel,
                  TFBlipVisionModel,
              )

else:
       import sys

       UpperCAmelCase_									=	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)








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 				__lowerCAmelCase       (    UpperCamelCase__):







      def __init__(    self		,      lowerCAmelCase__		,      lowerCAmelCase__ = None		,      lowerCAmelCase__ = None		,      lowerCAmelCase__ = True		,      lowerCAmelCase__ = None		,      lowerCAmelCase__ = False		,      lowerCAmelCase__ = None		,      lowerCAmelCase__ = True		,      lowerCAmelCase__ = "arrow"		,      **lowerCAmelCase__		,      )   ->						Optional[int]:



        '''simple docstring'''




        super().__init__(
            split=lowerCAmelCase__		,      features=lowerCAmelCase__		,      cache_dir=lowerCAmelCase__		,      keep_in_memory=lowerCAmelCase__		,      streaming=lowerCAmelCase__		,      **lowerCAmelCase__		,      )
        a__	:					int										=load_from_cache_file
        a__	:					Tuple										=file_format
        a__	:					List[Any]										=Spark(
            df=lowerCAmelCase__		,      features=lowerCAmelCase__		,      cache_dir=lowerCAmelCase__		,      working_dir=lowerCAmelCase__		,      **lowerCAmelCase__		,      )







      def    _lowercase  (    self							)   ->						str:



        '''simple docstring'''




        if self.streaming:
          return self.builder.as_streaming_dataset(split=self.split							)
        a__	:					str										=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							)






