



'''simple docstring'''
from __future__ import annotations

import unittest

import numpy as np

from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
					import tensorflow as tf

					from transformers import GPTaTokenizer, TFOPTForCausalLM, TFOPTModel






def A__   (					UpperCAmelCase_  ,  UpperCAmelCase_  ,  UpperCAmelCase_=None  ,  UpperCAmelCase_=None							):
						if attention_mask is None:
												_UpperCamelCase :		str			    =       tf.cast(tf.math.not_equal(UpperCAmelCase_  ,  config.pad_token_id							)  ,  tf.inta							)
						return {"input_ids": input_ids, "attention_mask": attention_mask}






@require_tf
class 							lowercase__     :
	lowercase__      =      OPTConfig
	lowercase__      =      {}
	lowercase__      =      """gelu"""





	def __init__(			self :    Union[str, Any]			,lowerCamelCase__ :    Optional[Any]			,lowerCamelCase__ :    Optional[Any]=13			,lowerCamelCase__ :    Optional[int]=7			,lowerCamelCase__ :    Dict=True			,lowerCamelCase__ :    Tuple=False			,lowerCamelCase__ :    Dict=99			,lowerCamelCase__ :    Dict=16			,lowerCamelCase__ :    Dict=2			,lowerCamelCase__ :    Any=4			,lowerCamelCase__ :    Any=4			,lowerCamelCase__ :    int="gelu"			,lowerCamelCase__ :    Optional[int]=0.1			,lowerCamelCase__ :    str=0.1			,lowerCamelCase__ :    List[str]=20			,lowerCamelCase__ :    List[str]=2			,lowerCamelCase__ :    Tuple=1			,lowerCamelCase__ :    int=0			,lowerCamelCase__ :    List[Any]=16			,lowerCamelCase__ :    List[Any]=16			,):







							'''simple docstring'''
							_UpperCamelCase :		Tuple			    =       parent
							_UpperCamelCase :		List[str]			    =       batch_size
							_UpperCamelCase :		Optional[int]			    =       seq_length
							_UpperCamelCase :		List[str]			    =       is_training
							_UpperCamelCase :		List[str]			    =       use_labels
							_UpperCamelCase :		Optional[Any]			    =       vocab_size
							_UpperCamelCase :		Optional[Any]			    =       hidden_size
							_UpperCamelCase :		List[str]			    =       num_hidden_layers
							_UpperCamelCase :		Any			    =       num_attention_heads
							_UpperCamelCase :		int			    =       intermediate_size
							_UpperCamelCase :		List[str]			    =       hidden_act
							_UpperCamelCase :		List[Any]			    =       hidden_dropout_prob
							_UpperCamelCase :		Dict			    =       attention_probs_dropout_prob
							_UpperCamelCase :		Optional[Any]			    =       max_position_embeddings
							_UpperCamelCase :		Any			    =       eos_token_id
							_UpperCamelCase :		Union[str, Any]			    =       pad_token_id
							_UpperCamelCase :		Union[str, Any]			    =       bos_token_id
							_UpperCamelCase :		Tuple			    =       embed_dim
							_UpperCamelCase :		List[Any]			    =       word_embed_proj_dim
							_UpperCamelCase :		Optional[Any]			    =       False





	def      UpperCamelCase_  (			self :    Optional[Any]			):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       ids_tensor([self.batch_size, self.seq_length - 1]			,self.vocab_size			)
							_UpperCamelCase :		int			    =       tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size			)			,1			)
							_UpperCamelCase :		List[Any]			    =       tf.concat([input_ids, eos_tensor]			,axis=1			)

							_UpperCamelCase :		str			    =       self.config_cls(
							    vocab_size=self.vocab_size			,hidden_size=self.hidden_size			,num_hidden_layers=self.num_hidden_layers			,num_attention_heads=self.num_attention_heads			,ffn_dim=self.intermediate_size			,dropout=self.hidden_dropout_prob			,attention_dropout=self.attention_probs_dropout_prob			,max_position_embeddings=self.max_position_embeddings			,eos_token_id=self.eos_token_id			,bos_token_id=self.bos_token_id			,pad_token_id=self.pad_token_id			,embed_dim=self.embed_dim			,word_embed_proj_dim=self.word_embed_proj_dim			,is_encoder_decoder=lowerCamelCase__			,**self.config_updates			,)
							_UpperCamelCase :		Optional[int]			    =       prepare_opt_inputs_dict(lowerCamelCase__			,lowerCamelCase__			)
							return config, inputs_dict





	def      UpperCamelCase_  (			self :    Tuple			,lowerCamelCase__ :    int			,lowerCamelCase__ :    Union[str, Any]			):







							'''simple docstring'''
							_UpperCamelCase :		Any			    =       TFOPTModel(config=lowerCamelCase__			)
							_UpperCamelCase :		List[str]			    =       inputs_dict['input_ids']

							_UpperCamelCase :		Any			    =       input_ids[:1, :]
							_UpperCamelCase :		Optional[Any]			    =       inputs_dict['attention_mask'][:1, :]
							_UpperCamelCase :		Dict			    =       1

							# first forward pass
							_UpperCamelCase :		int			    =       model(lowerCamelCase__			,attention_mask=lowerCamelCase__			,use_cache=lowerCamelCase__			)

							_UpperCamelCase    ,      _UpperCamelCase :		int			    =       outputs.to_tuple()

							# create hypothetical next token and extent to next_input_ids
							_UpperCamelCase :		Optional[int]			    =       ids_tensor((self.batch_size, 3)			,config.vocab_size			)
							_UpperCamelCase :		Optional[int]			    =       tf.cast(ids_tensor((self.batch_size, 3)			,2			)			,tf.inta			)

							# append to next input_ids and
							_UpperCamelCase :		Tuple			    =       tf.concat([input_ids, next_tokens]			,axis=-1			)
							_UpperCamelCase :		Tuple			    =       tf.concat([attention_mask, next_attn_mask]			,axis=-1			)

							_UpperCamelCase :		List[Any]			    =       model(lowerCamelCase__			,attention_mask=lowerCamelCase__			)[0]
							_UpperCamelCase :		Dict			    =       model(lowerCamelCase__			,attention_mask=lowerCamelCase__			,past_key_values=lowerCamelCase__			)[0]

							self.parent.assertEqual(next_tokens.shape[1]			,output_from_past.shape[1]			)

							# select random slice
							_UpperCamelCase :		Optional[int]			    =       int(ids_tensor((1,)			,output_from_past.shape[-1]			)			)
							_UpperCamelCase :		List[Any]			    =       output_from_no_past[:, -3:, random_slice_idx]
							_UpperCamelCase :		Optional[Any]			    =       output_from_past[:, :, random_slice_idx]

							# test that outputs are equal for slice
							tf.debugging.assert_near(lowerCamelCase__			,lowerCamelCase__			,rtol=1E-3			)






@require_tf
class 							lowercase__     (							lowercase						, lowercase						, unittest.TestCase       ):
	lowercase__      =      (TFOPTModel, TFOPTForCausalLM) if is_tf_available() else ()
	lowercase__      =      (TFOPTForCausalLM,) if is_tf_available() else ()
	lowercase__      =      (
	    {"""feature-extraction""": TFOPTModel, """text-generation""": TFOPTForCausalLM} if is_tf_available() else {}
	)
	lowercase__      =      False
	lowercase__      =      False
	lowercase__      =      False
	lowercase__      =      10





	def      UpperCamelCase_  (			self :    Tuple			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       TFOPTModelTester(self			)
							_UpperCamelCase :		Any			    =       ConfigTester(self			,config_class=lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    Optional[int]			):







							'''simple docstring'''
							self.config_tester.run_common_tests()





	def      UpperCamelCase_  (			self :    Any			):







							'''simple docstring'''
							_UpperCamelCase :		Union[str, Any]			    =       self.model_tester.prepare_config_and_inputs_for_common()
							self.model_tester.check_decoder_model_past_large_inputs(*lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    str			):







							'''simple docstring'''
							_UpperCamelCase    ,      _UpperCamelCase :		List[Any]			    =       self.model_tester.prepare_config_and_inputs_for_common()

							def _get_word_embedding_weight(lowerCamelCase__ :    Union[str, Any]			,lowerCamelCase__ :    int			):
													if hasattr(lowerCamelCase__			,'weight'			):
																			return embedding_layer.weight
													else:
																			# Here we build the word embeddings weights if not exists.
																			# And then we retry to get the attribute once built.
																			model.build()
																			if hasattr(lowerCamelCase__			,'weight'			):
																									return embedding_layer.weight
																			else:
																									return None

							for model_class in self.all_model_classes:
													for size in [config.vocab_size - 10, config.vocab_size + 10]:
																			# build the embeddings
																			_UpperCamelCase :		Dict			    =       model_class(config=lowerCamelCase__			)
																			_UpperCamelCase :		Dict			    =       _get_word_embedding_weight(lowerCamelCase__			,model.get_input_embeddings()			)
																			_UpperCamelCase :		List[Any]			    =       _get_word_embedding_weight(lowerCamelCase__			,model.get_output_embeddings()			)

																			# reshape the embeddings
																			model.resize_token_embeddings(lowerCamelCase__			)
																			_UpperCamelCase :		Optional[int]			    =       _get_word_embedding_weight(lowerCamelCase__			,model.get_input_embeddings()			)
																			_UpperCamelCase :		Dict			    =       _get_word_embedding_weight(lowerCamelCase__			,model.get_output_embeddings()			)

																			# check that the resized embeddings size matches the desired size.
																			_UpperCamelCase :		List[Any]			    =       size if size is not None else config.vocab_size

																			self.assertEqual(new_input_embeddings.shape[0]			,lowerCamelCase__			)

																			# check that weights remain the same after resizing
																			_UpperCamelCase :		Union[str, Any]			    =       True
																			for pa, pa in zip(old_input_embeddings.value()			,new_input_embeddings.value()			):
																									if tf.math.reduce_sum(tf.math.abs(pa - pa			)			) > 0:
																															_UpperCamelCase :		Dict			    =       False
																			self.assertTrue(lowerCamelCase__			)

																			if old_output_embeddings is not None and new_output_embeddings is not None:
																									self.assertEqual(new_output_embeddings.shape[0]			,lowerCamelCase__			)

																									_UpperCamelCase :		Any			    =       True
																									for pa, pa in zip(old_output_embeddings.value()			,new_output_embeddings.value()			):
																															if tf.math.reduce_sum(tf.math.abs(pa - pa			)			) > 0:
																																					_UpperCamelCase :		Optional[int]			    =       False
																									self.assertTrue(lowerCamelCase__			)






def A__   (					UpperCAmelCase_							):
						return tf.constant(UpperCAmelCase_  ,  dtype=tf.intaa							)






@require_tf
class 							lowercase__     (							unittest.TestCase       ):
	lowercase__      =      99





	def      UpperCamelCase_  (			self :    str			):







							'''simple docstring'''
							_UpperCamelCase :		Optional[int]			    =       tf.ones((4, 1)			,dtype=tf.intaa			) * 2
							_UpperCamelCase :		List[Any]			    =       tf.concat([ids_tensor((4, 6)			,self.vocab_size - 3			) + 3, eos_column_vector]			,axis=1			)
							_UpperCamelCase :		Optional[int]			    =       input_ids.shape[0]
							_UpperCamelCase :		str			    =       OPTConfig(
							    vocab_size=self.vocab_size			,hidden_size=24			,num_hidden_layers=2			,num_attention_heads=2			,ffn_dim=32			,max_position_embeddings=48			,eos_token_id=2			,pad_token_id=1			,bos_token_id=0			,)
							return config, input_ids, batch_size






@require_sentencepiece
@require_tf
class 							lowercase__     (							unittest.TestCase       ):





	@slow
	def      UpperCamelCase_  (			self :    Optional[int]			):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       TFOPTModel.from_pretrained('facebook/opt-350m'			)
							_UpperCamelCase :		Union[str, Any]			    =       _long_tensor([[0, 31414, 232, 328, 740, 1140, 12695, 69, 46078, 1588, 2]]			)
							_UpperCamelCase :		Tuple			    =       tf.not_equal(lowerCamelCase__			,model.config.pad_token_id			)
							with tf.GradientTape():
													_UpperCamelCase :		str			    =       model(input_ids=lowerCamelCase__			,attention_mask=lowerCamelCase__			).last_hidden_state
							_UpperCamelCase :		Any			    =       (1, 11, 512)
							self.assertEqual(output.shape			,lowerCamelCase__			)
							_UpperCamelCase :		List[str]			    =       tf.constant(
							    [[-0.2_8_7_3, -1.9_2_1_8, -0.3_0_3_3], [-1.2_7_1_0, -0.1_3_3_8, -0.1_9_0_2], [0.4_0_9_5, 0.1_2_1_4, -1.3_1_2_1]]			)
							self.assertTrue(np.allclose(output[:, :3, :3]			,lowerCamelCase__			,atol=4E-3			)			)

							_UpperCamelCase :		List[Any]			    =       tf.function(lowerCamelCase__			,jit_compile=lowerCamelCase__			)
							_UpperCamelCase :		Optional[int]			    =       xla_generate(lowerCamelCase__			,lowerCamelCase__			)[0]
							self.assertTrue(np.allclose(output[:, :3, :3]			,lowerCamelCase__			,atol=4E-2			)			)






@require_tf
@slow
class 							lowercase__     (							unittest.TestCase       ):





	def      UpperCamelCase_  (			self :    Optional[int]			):







							'''simple docstring'''
							super().setUp()
							_UpperCamelCase :		Optional[int]			    =       'facebook/opt-350m'





	def      UpperCamelCase_  (			self :    List[str]			):







							'''simple docstring'''
							_UpperCamelCase :		Union[str, Any]			    =       TFOPTForCausalLM.from_pretrained(self.path_model			)
							_UpperCamelCase :		Optional[int]			    =       GPTaTokenizer.from_pretrained(self.path_model			)

							_UpperCamelCase :		List[Any]			    =       [
							    'Today is a beautiful day and I want to',
							    'In the city of',
							    'Paris is the capital of France and',
							    'Computers and mobile phones have taken',
							]
							# verify that prompt without BOS token is identical to Metaseq -> add_special_tokens=False
							_UpperCamelCase :		Dict			    =       tokenizer(lowerCamelCase__			,return_tensors='tf'			,padding=lowerCamelCase__			,add_special_tokens=lowerCamelCase__			)
							_UpperCamelCase :		List[str]			    =       tf.math.reduce_mean(model(inputs.input_ids			,attention_mask=inputs.attention_mask			)[0]			,axis=-1			)
							_UpperCamelCase :		List[Any]			    =       tf.constant(
							    [
							        [1.3_8_5_1, -1_3.8_9_2_3, -1_0.5_2_2_9, -1_0.7_5_3_3, -0.2_3_0_9, -1_0.2_3_8_4, -0.5_3_6_5, -9.0_9_4_7, -5.1_6_7_0],
							        [-4.7_0_7_3, -1_0.6_2_7_6, -3.9_4_1_5, -2_1.5_2_4_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2],
							        [0.6_2_4_7, -3.4_2_2_9, -8.9_1_7_9, -1.4_2_9_7, -1_4.1_6_5_0, 1.4_1_4_6, -9.0_2_1_8, -0.2_7_0_3, -0.2_7_0_3],
							        [6.4_7_8_3, -1.9_9_1_3, -1_0.7_9_2_6, -2.3_3_3_6, 1.5_0_9_2, -0.9_9_7_4, -6.8_2_1_3, 1.3_4_7_7, 1.3_4_7_7],
							    ]			)
							self.assertTrue(np.allclose(lowerCamelCase__			,lowerCamelCase__			,atol=1E-4			)			)

							_UpperCamelCase :		int			    =       tf.function(lowerCamelCase__			,jit_compile=lowerCamelCase__			)
							_UpperCamelCase :		Any			    =       tf.math.reduce_mean(xla_generate(inputs.input_ids			,attention_mask=inputs.attention_mask			)[0]			,axis=-1			)
							self.assertTrue(np.allclose(lowerCamelCase__			,lowerCamelCase__			,atol=1E-4			)			)






@require_tf
@slow
class 							lowercase__     (							unittest.TestCase       ):





	@property
	def      UpperCamelCase_  (			self :    List[str]			):







							'''simple docstring'''
							return [
							    "Today is a beautiful day and I want",
							    "In the city of",
							    "Paris is the capital of France and",
							    "Computers and mobile phones have taken",
							]





	def      UpperCamelCase_  (			self :    Any			):







							'''simple docstring'''
							_UpperCamelCase :		Optional[int]			    =       'facebook/opt-125m'

							_UpperCamelCase :		int			    =       [
							    'Today is a beautiful day and I want to',
							    'In the city of New York, the city',
							    'Paris is the capital of France and the capital',
							    'Computers and mobile phones have taken over the',
							]

							_UpperCamelCase :		List[Any]			    =       []
							_UpperCamelCase :		str			    =       GPTaTokenizer.from_pretrained(lowerCamelCase__			)
							_UpperCamelCase :		List[str]			    =       TFOPTForCausalLM.from_pretrained(lowerCamelCase__			)

							for prompt in self.prompts:
													_UpperCamelCase :		List[Any]			    =       tokenizer(lowerCamelCase__			,return_tensors='tf'			).input_ids

													_UpperCamelCase :		Any			    =       model.generate(lowerCamelCase__			,max_length=10			)

													_UpperCamelCase :		Dict			    =       tokenizer.batch_decode(lowerCamelCase__			,skip_special_tokens=lowerCamelCase__			)
													predicted_outputs += generated_string

							self.assertListEqual(lowerCamelCase__			,lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    List[str]			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       'facebook/opt-350m'

							_UpperCamelCase :		Dict			    =       GPTaTokenizer.from_pretrained(lowerCamelCase__			)
							_UpperCamelCase :		List[Any]			    =       TFOPTForCausalLM.from_pretrained(lowerCamelCase__			)

							_UpperCamelCase :		Dict			    =       'left'

							# use different length sentences to test batching
							_UpperCamelCase :		List[Any]			    =       [
							    'Hello, my dog is a little',
							    'Today, I',
							]

							_UpperCamelCase :		List[str]			    =       tokenizer(lowerCamelCase__			,return_tensors='tf'			,padding=lowerCamelCase__			)
							_UpperCamelCase :		Optional[int]			    =       inputs['input_ids']

							_UpperCamelCase :		List[Any]			    =       model.generate(input_ids=lowerCamelCase__			,attention_mask=inputs['attention_mask']			)

							_UpperCamelCase :		Dict			    =       tokenizer(sentences[0]			,return_tensors='tf'			).input_ids
							_UpperCamelCase :		Union[str, Any]			    =       model.generate(input_ids=lowerCamelCase__			)

							_UpperCamelCase :		Dict			    =       inputs_non_padded.shape[-1] - tf.math.reduce_sum(
							    tf.cast(inputs['attention_mask'][-1]			,tf.intaa			)			)
							_UpperCamelCase :		Union[str, Any]			    =       tokenizer(sentences[1]			,return_tensors='tf'			).input_ids
							_UpperCamelCase :		Any			    =       model.generate(input_ids=lowerCamelCase__			,max_length=model.config.max_length - num_paddings			)

							_UpperCamelCase :		Optional[int]			    =       tokenizer.batch_decode(lowerCamelCase__			,skip_special_tokens=lowerCamelCase__			)
							_UpperCamelCase :		Dict			    =       tokenizer.decode(output_non_padded[0]			,skip_special_tokens=lowerCamelCase__			)
							_UpperCamelCase :		List[Any]			    =       tokenizer.decode(output_padded[0]			,skip_special_tokens=lowerCamelCase__			)

							_UpperCamelCase :		Union[str, Any]			    =       [
							    'Hello, my dog is a little bit of a dork.\nI\'m a little bit',
							    'Today, I was in the middle of a conversation with a friend about the',
							]
							self.assertListEqual(lowerCamelCase__			,lowerCamelCase__			)
							self.assertListEqual(lowerCamelCase__			,[non_padded_sentence, padded_sentence]			)





	def      UpperCamelCase_  (			self :    List[Any]			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       'facebook/opt-350m'

							_UpperCamelCase :		Any			    =       [
							    'Today is a beautiful day and I want to',
							    'In the city of San Francisco, the city',
							    'Paris is the capital of France and the capital',
							    'Computers and mobile phones have taken over the',
							]

							_UpperCamelCase :		Optional[int]			    =       []
							_UpperCamelCase :		Optional[Any]			    =       GPTaTokenizer.from_pretrained(lowerCamelCase__			)
							_UpperCamelCase :		Any			    =       TFOPTForCausalLM.from_pretrained(lowerCamelCase__			)

							for prompt in self.prompts:
													_UpperCamelCase :		Union[str, Any]			    =       tokenizer(lowerCamelCase__			,return_tensors='tf'			).input_ids

													_UpperCamelCase :		str			    =       model.generate(lowerCamelCase__			,max_length=10			)

													_UpperCamelCase :		Tuple			    =       tokenizer.batch_decode(lowerCamelCase__			,skip_special_tokens=lowerCamelCase__			)
													predicted_outputs += generated_string

							self.assertListEqual(lowerCamelCase__			,lowerCamelCase__			)







'''simple docstring'''
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,
)


snake_case_			:     Optional[Any]  	=  {
    '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:
					snake_case_			:     Optional[int]  	=  ['CLIPTokenizerFast']

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  ['CLIPFeatureExtractor']
					snake_case_			:     Dict  	=  ['CLIPImageProcessor']

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

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

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  [
					    '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

					snake_case_			:     str  	=  _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


