



import itertools
import os
import re


__A       =						re.compile(r'''([A-Z]+)([A-Z][a-z])''')
__A       =						re.compile(r'''([a-z\d])([A-Z])''')

__A       =						re.compile(r'''(?<!_)_(?!_)''')
__A       =						re.compile(r'''(_{2,})''')

__A       =						r"^\w+(\.\w+)*$"

__A       =						r"<>:/\|?*"



def 	__a					(   lowerCAmelCase_       : List[str]    )				->			List[str]:






						'''simple docstring'''



						UpperCAmelCase_=       _uppercase_uppercase_re.sub(r"""\1_\2"""      ,__lowerCAmelCase    )
						UpperCAmelCase_=       _lowercase_uppercase_re.sub(r"""\1_\2"""      ,__lowerCAmelCase    )
						return name.lower()



def 	__a					(   lowerCAmelCase_       : int    )				->			Optional[Any]:






						'''simple docstring'''



						UpperCAmelCase_=       _single_underscore_re.split(__lowerCAmelCase    )
						UpperCAmelCase_=       [_multiple_underscores_re.split(__lowerCAmelCase    ) for n in name]
						return "".join(n.capitalize() for n in itertools.chain.from_iterable(__lowerCAmelCase    ) if n != """"""    )



def 	__a					(   lowerCAmelCase_       : Tuple    )				->			Optional[Any]:






						'''simple docstring'''



						if os.path.basename(__lowerCAmelCase    ) != name:
												raise ValueError(F"""Should be a dataset name, not a path: {name}"""    )
						return camelcase_to_snakecase(__lowerCAmelCase    )



def 	__a					(   lowerCAmelCase_       : Tuple      ,lowerCAmelCase_       : Optional[int]    )				->			Any:






						'''simple docstring'''



						if os.path.basename(__lowerCAmelCase    ) != name:
												raise ValueError(F"""Should be a dataset name, not a path: {name}"""    )
						if not re.match(_split_re      ,__lowerCAmelCase    ):
												raise ValueError(F"""Split name should match \'{_split_re}\'\' but got \'{split}\'."""    )
						return F"""{filename_prefix_for_name(__lowerCAmelCase    )}-{split}"""



def 	__a					(   lowerCAmelCase_       : Tuple      ,lowerCAmelCase_       : Any      ,lowerCAmelCase_       : Union[str, Any]      ,lowerCAmelCase_       : Optional[int]=None    )				->			Optional[Any]:






						'''simple docstring'''



						UpperCAmelCase_=       filename_prefix_for_split(__lowerCAmelCase      ,__lowerCAmelCase    )
						if filetype_suffix:
												prefix += F""".{filetype_suffix}"""
						UpperCAmelCase_=       os.path.join(__lowerCAmelCase      ,__lowerCAmelCase    )
						return F"""{filepath}*"""



def 	__a					(   lowerCAmelCase_       : Any      ,lowerCAmelCase_       : Any      ,lowerCAmelCase_       : List[str]      ,lowerCAmelCase_       : int=None      ,lowerCAmelCase_       : Any=None    )				->			List[str]:






						'''simple docstring'''



						UpperCAmelCase_=       filename_prefix_for_split(__lowerCAmelCase      ,__lowerCAmelCase    )
						UpperCAmelCase_=       os.path.join(__lowerCAmelCase      ,__lowerCAmelCase    )

						if shard_lengths:
												UpperCAmelCase_=       len(__lowerCAmelCase    )
												UpperCAmelCase_=       [F"""{prefix}-{shard_id:05d}-of-{num_shards:05d}""" for shard_id in range(__lowerCAmelCase    )]
												if filetype_suffix:
																		UpperCAmelCase_=       [filename + F""".{filetype_suffix}""" for filename in filenames]
												return filenames
						else:
												UpperCAmelCase_=       prefix
												if filetype_suffix:
																		filename += F""".{filetype_suffix}"""
												return [filename]





from typing import TYPE_CHECKING

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


__A       =						{
    '''configuration_clip''': [
        '''CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPConfig''',
        '''CLIPOnnxConfig''',
        '''CLIPTextConfig''',
        '''CLIPVisionConfig''',
    ],
    '''processing_clip''': ['''CLIPProcessor'''],
    '''tokenization_clip''': ['''CLIPTokenizer'''],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A       =						['''CLIPTokenizerFast''']

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A       =						['''CLIPFeatureExtractor''']
	__A       =						['''CLIPImageProcessor''']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A       =						[
	    '''CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''CLIPModel''',
	    '''CLIPPreTrainedModel''',
	    '''CLIPTextModel''',
	    '''CLIPTextModelWithProjection''',
	    '''CLIPVisionModel''',
	    '''CLIPVisionModelWithProjection''',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A       =						[
	    '''TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''TFCLIPModel''',
	    '''TFCLIPPreTrainedModel''',
	    '''TFCLIPTextModel''',
	    '''TFCLIPVisionModel''',
	]

try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A       =						[
	    '''FlaxCLIPModel''',
	    '''FlaxCLIPPreTrainedModel''',
	    '''FlaxCLIPTextModel''',
	    '''FlaxCLIPTextPreTrainedModel''',
	    '''FlaxCLIPVisionModel''',
	    '''FlaxCLIPVisionPreTrainedModel''',
	]


if TYPE_CHECKING:
	from .configuration_clip import (
	    CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    CLIPConfig,
	    CLIPOnnxConfig,
	    CLIPTextConfig,
	    CLIPVisionConfig,
	)
	from .processing_clip import CLIPProcessor
	from .tokenization_clip import CLIPTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_clip_fast import CLIPTokenizerFast

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_clip import CLIPFeatureExtractor
		from .image_processing_clip import CLIPImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_clip import (
		    CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
		    CLIPModel,
		    CLIPPreTrainedModel,
		    CLIPTextModel,
		    CLIPTextModelWithProjection,
		    CLIPVisionModel,
		    CLIPVisionModelWithProjection,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_clip import (
		    TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFCLIPModel,
		    TFCLIPPreTrainedModel,
		    TFCLIPTextModel,
		    TFCLIPVisionModel,
		)

	try:
		if not is_flax_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_flax_clip import (
		    FlaxCLIPModel,
		    FlaxCLIPPreTrainedModel,
		    FlaxCLIPTextModel,
		    FlaxCLIPTextPreTrainedModel,
		    FlaxCLIPVisionModel,
		    FlaxCLIPVisionPreTrainedModel,
		)


else:
	import sys

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




