



'''simple docstring'''






from __future__ import annotations

import collections
import tempfile
import unittest

import numpy as np

from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import is_tf_available, is_vision_available

from ...test_modeling_tf_common import floats_tensor, ids_tensor, random_attention_mask
from ..bert.test_modeling_tf_bert import TFBertModelTester
from ..clip.test_modeling_tf_clip import TFCLIPVisionModelTester
from ..deit.test_modeling_tf_deit import TFDeiTModelTester
from ..roberta.test_modeling_tf_roberta import TFRobertaModelTester
from ..vit.test_modeling_tf_vit import TFViTModelTester


if is_tf_available():
						from transformers import (
						    TFBertModel,
						    TFCLIPVisionModel,
						    TFDeiTModel,
						    TFRobertaModel,
						    TFVisionTextDualEncoderModel,
						    TFViTModel,
						    VisionTextDualEncoderConfig,
						)

if is_vision_available():
						from PIL import Image

						from transformers import VisionTextDualEncoderProcessor


def 					snake_case_	(   _lowerCAmelCase    :		Union[str, Any]    ) ->  int:

							if isinstance(a__  , collections.abc.Iterable    ):
														return x
							return (x, x)

@require_tf
class 							SCREAMING_SNAKE_CASE:







	"""simple docstring"""






	def 	A      (		self     :	Union[str, Any]						,     __snake_case     :	Optional[Any]						,     __snake_case     :	Any						)     ->						int:
								pass







	def 	A      (		self     :	str						)     ->						Optional[int]:
								pass







	def 	A      (		self     :	Any						)     ->						str:
								pass







	def 	A      (		self     :	Optional[int]						,     __snake_case     :	str						,     __snake_case     :	Optional[int]						,     __snake_case     :	int						,     __snake_case     :	Any						,     __snake_case     :	Dict=None						,     **__snake_case     :	Optional[int]						)     ->						Union[str, Any]:
								UpperCAmelCase					:			int									=						VisionTextDualEncoderConfig.from_vision_text_configs(lowercase_						,     lowercase_						)

								UpperCAmelCase					:			Tuple									=						TFVisionTextDualEncoderModel(lowercase_						)

								UpperCAmelCase					:			int									=						model(input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						)

								self.assertEqual(output['''text_embeds'''].shape						,     (input_ids.shape[0], config.projection_dim)						)
								self.assertEqual(output['''image_embeds'''].shape						,     (pixel_values.shape[0], config.projection_dim)						)







	def 	A      (		self     :	str						,     __snake_case     :	Any						,     __snake_case     :	Optional[int]						,     __snake_case     :	Optional[Any]						,     __snake_case     :	str						,     __snake_case     :	List[str]=None						,     **__snake_case     :	int						)     ->						List[Any]:
								UpperCAmelCase				,						UpperCAmelCase					:			Optional[Any]									=						self.get_vision_text_model(lowercase_						,     lowercase_						)
								UpperCAmelCase					:			List[str]									=						TFVisionTextDualEncoderModel(vision_model=lowercase_						,     text_model=lowercase_						)

								UpperCAmelCase					:			Optional[int]									=						model(input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						)

								self.assertEqual(output['''text_embeds'''].shape						,     (input_ids.shape[0], model.config.projection_dim)						)
								self.assertEqual(output['''image_embeds'''].shape						,     (pixel_values.shape[0], model.config.projection_dim)						)







	def 	A      (		self     :	List[Any]						,     __snake_case     :	Optional[int]						,     __snake_case     :	int						,     __snake_case     :	str						,     __snake_case     :	int						,     __snake_case     :	Dict=None						,     **__snake_case     :	Optional[Any]						)     ->						str:
								UpperCAmelCase				,						UpperCAmelCase					:			Tuple									=						self.get_vision_text_model(lowercase_						,     lowercase_						)
								UpperCAmelCase					:			List[str]									=						{'''vision_model''': vision_model, '''text_model''': text_model}
								UpperCAmelCase					:			int									=						TFVisionTextDualEncoderModel.from_vision_text_pretrained(**lowercase_						)

								UpperCAmelCase					:			Dict									=						model(input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						)

								self.assertEqual(output['''text_embeds'''].shape						,     (input_ids.shape[0], model.config.projection_dim)						)
								self.assertEqual(output['''image_embeds'''].shape						,     (pixel_values.shape[0], model.config.projection_dim)						)







	def 	A      (		self     :	Tuple						,     __snake_case     :	List[str]						,     __snake_case     :	Optional[Any]						,     __snake_case     :	List[Any]						,     __snake_case     :	Optional[Any]						,     __snake_case     :	Tuple=None						,     **__snake_case     :	Optional[Any]						)     ->						List[Any]:
								UpperCAmelCase				,						UpperCAmelCase					:			List[str]									=						self.get_vision_text_model(lowercase_						,     lowercase_						)
								UpperCAmelCase					:			Dict									=						TFVisionTextDualEncoderModel(vision_model=lowercase_						,     text_model=lowercase_						)

								UpperCAmelCase					:			str									=						model(input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						)
								UpperCAmelCase					:			List[str]									=						output[0].numpy()

								with tempfile.TemporaryDirectory() as tmpdirname:
															model.save_pretrained(lowercase_						)
															UpperCAmelCase					:			Optional[Any]									=						TFVisionTextDualEncoderModel.from_pretrained(lowercase_						)

															UpperCAmelCase					:			Optional[int]									=						model(input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						)
															UpperCAmelCase					:			Tuple									=						after_output[0].numpy()
															UpperCAmelCase					:			Union[str, Any]									=						np.amax(np.abs(out_a - out_a						)						)
															self.assertLessEqual(lowercase_						,     1E-5						)







	def 	A      (		self     :	List[Any]						,     __snake_case     :	List[str]						,     __snake_case     :	Tuple						,     __snake_case     :	List[Any]						,     __snake_case     :	int						,     __snake_case     :	Any=None						,     **__snake_case     :	int						)     ->						str:
								UpperCAmelCase				,						UpperCAmelCase					:			int									=						self.get_vision_text_model(lowercase_						,     lowercase_						)
								UpperCAmelCase					:			Optional[Any]									=						TFVisionTextDualEncoderModel(vision_model=lowercase_						,     text_model=lowercase_						)

								UpperCAmelCase					:			int									=						model(
								    input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						,     output_attentions=lowercase_						)

								UpperCAmelCase					:			Dict									=						output.vision_model_output.attentions
								self.assertEqual(len(lowercase_						)						,     vision_config.num_hidden_layers						)

								# in ViT, the seq_len equals the number of patches + 1 (we add 1 for the [CLS] token)
								UpperCAmelCase					:			str									=						to_atuple(vision_model.config.image_size						)
								UpperCAmelCase					:			Tuple									=						to_atuple(vision_model.config.patch_size						)
								UpperCAmelCase					:			Optional[int]									=						(image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])
								UpperCAmelCase					:			List[Any]									=						num_patches + 1
								self.assertEqual(vision_attentions[0].shape[-3:]						,     (vision_config.num_attention_heads, seq_len, seq_len)						)

								UpperCAmelCase					:			List[Any]									=						output.text_model_output.attentions
								self.assertEqual(len(lowercase_						)						,     text_config.num_hidden_layers						)

								self.assertEqual(
								    text_attentions[0].shape[-3:]						,     (text_config.num_attention_heads, input_ids.shape[-1], input_ids.shape[-1])						,     )







	def 	A      (		self     :	Dict						,     __snake_case     :	np.ndarray						,     __snake_case     :	np.ndarray						,     __snake_case     :	float						)     ->						Dict:
								UpperCAmelCase					:			Dict									=						np.abs((a - b)						).max()
								self.assertLessEqual(lowercase_						,     lowercase_						,     F"""Difference between torch and flax is {diff} (>= {tol})."""						)







	def 	A      (		self     :	List[Any]						)     ->						str:
								UpperCAmelCase					:			List[Any]									=						self.prepare_config_and_inputs()
								self.check_vision_text_dual_encoder_model(**lowercase_						)







	def 	A      (		self     :	Tuple						)     ->						Union[str, Any]:
								UpperCAmelCase					:			Dict									=						self.prepare_config_and_inputs()
								self.check_model_from_pretrained_configs(**lowercase_						)







	def 	A      (		self     :	Optional[int]						)     ->						Union[str, Any]:
								UpperCAmelCase					:			str									=						self.prepare_config_and_inputs()
								self.check_vision_text_dual_encoder_from_pretrained(**lowercase_						)







	def 	A      (		self     :	Dict						)     ->						Tuple:
								UpperCAmelCase					:			Dict									=						self.prepare_config_and_inputs()
								self.check_save_load(**lowercase_						)







	def 	A      (		self     :	Dict						)     ->						List[str]:
								UpperCAmelCase					:			Optional[int]									=						self.prepare_config_and_inputs()
								self.check_vision_text_output_attention(**lowercase_						)







	@slow
	def 	A      (		self     :	int						)     ->						Any:
								UpperCAmelCase				,						UpperCAmelCase					:			int									=						self.get_pretrained_model_and_inputs()

								UpperCAmelCase					:			Any									=						model_a(**lowercase_						)
								UpperCAmelCase					:			Optional[int]									=						outputs[0].numpy()

								with tempfile.TemporaryDirectory() as tmp_dirname:
															model_a.save_pretrained(lowercase_						)
															UpperCAmelCase					:			str									=						TFVisionTextDualEncoderModel.from_pretrained(lowercase_						)

															UpperCAmelCase					:			str									=						model_a(**lowercase_						)
															UpperCAmelCase					:			Union[str, Any]									=						after_outputs[0].numpy()
															UpperCAmelCase					:			List[Any]									=						np.amax(np.abs(out_a - out_a						)						)
															self.assertLessEqual(lowercase_						,     1E-5						)

@require_tf
class 							SCREAMING_SNAKE_CASE(				A__				,						unittest.TestCase     ):







	"""simple docstring"""






	def 	A      (		self     :	Any						)     ->						str:
								UpperCAmelCase					:			str									=						TFVisionTextDualEncoderModel.from_vision_text_pretrained(
								    '''hf-internal-testing/tiny-random-vit'''						,     '''hf-internal-testing/tiny-random-bert'''						)
								UpperCAmelCase					:			Tuple									=						13
								UpperCAmelCase					:			Union[str, Any]									=						floats_tensor(
								    [
								        batch_size,
								        model.vision_model.config.num_channels,
								        model.vision_model.config.image_size,
								        model.vision_model.config.image_size,
								    ]						)
								UpperCAmelCase					:			int									=						ids_tensor([batch_size, 4]						,     model.text_model.config.vocab_size						)
								UpperCAmelCase					:			Any									=						random_attention_mask([batch_size, 4]						)
								UpperCAmelCase					:			Optional[Any]									=						{'''pixel_values''': pixel_values, '''input_ids''': input_ids, '''attention_mask''': attention_mask}

								return model, inputs







	def 	A      (		self     :	int						,     __snake_case     :	Optional[Any]						,     __snake_case     :	int						)     ->						List[str]:
								UpperCAmelCase					:			Any									=						TFViTModel(lowercase_						,     name='''vision_model'''						)
								UpperCAmelCase					:			int									=						TFBertModel(lowercase_						,     name='''text_model'''						)
								return vision_model, text_model







	def 	A      (		self     :	Optional[Any]						)     ->						str:
								UpperCAmelCase					:			Tuple									=						TFViTModelTester(self						)
								UpperCAmelCase					:			int									=						TFBertModelTester(self						)
								UpperCAmelCase					:			Optional[int]									=						vit_model_tester.prepare_config_and_inputs()
								UpperCAmelCase					:			List[str]									=						bert_model_tester.prepare_config_and_inputs()

								UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase					:			str									=						vision_config_and_inputs

								(
								    (
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,												
								)					:			Optional[Any]									=						text_config_and_inputs

								return {
								    "text_config": text_config,
								    "vision_config": vision_config,
								    "pixel_values": pixel_values,
								    "attention_mask": input_mask,
								    "input_ids": input_ids,
								    "text_token_type_ids": token_type_ids,
								    "text_sequence_labels": sequence_labels,
								    "text_token_labels": token_labels,
								    "text_choice_labels": choice_labels,
								}

@require_tf
class 							SCREAMING_SNAKE_CASE(				A__				,						unittest.TestCase     ):







	"""simple docstring"""






	def 	A      (		self     :	Any						)     ->						str:
								UpperCAmelCase					:			int									=						TFVisionTextDualEncoderModel.from_vision_text_pretrained(
								    '''Rocketknight1/tiny-random-deit-tf'''						,     '''hf-internal-testing/tiny-random-roberta'''						)
								UpperCAmelCase					:			Dict									=						13
								UpperCAmelCase					:			List[str]									=						floats_tensor(
								    [
								        batch_size,
								        model.vision_model.config.num_channels,
								        model.vision_model.config.image_size,
								        model.vision_model.config.image_size,
								    ]						)
								UpperCAmelCase					:			Tuple									=						ids_tensor([batch_size, 4]						,     model.text_model.config.vocab_size						)
								UpperCAmelCase					:			Any									=						random_attention_mask([batch_size, 4]						)
								UpperCAmelCase					:			Optional[int]									=						{'''pixel_values''': pixel_values, '''input_ids''': input_ids, '''attention_mask''': attention_mask}

								return model, inputs







	def 	A      (		self     :	Optional[Any]						,     __snake_case     :	Union[str, Any]						,     __snake_case     :	str						,     __snake_case     :	Any						,     __snake_case     :	Union[str, Any]						,     __snake_case     :	Optional[int]=None						,     **__snake_case     :	Dict						)     ->						List[Any]:
								UpperCAmelCase				,						UpperCAmelCase					:			List[Any]									=						self.get_vision_text_model(lowercase_						,     lowercase_						)
								UpperCAmelCase					:			Tuple									=						TFVisionTextDualEncoderModel(vision_model=lowercase_						,     text_model=lowercase_						)

								UpperCAmelCase					:			Any									=						model(
								    input_ids=lowercase_						,     pixel_values=lowercase_						,     attention_mask=lowercase_						,     output_attentions=lowercase_						)

								UpperCAmelCase					:			Optional[int]									=						output.vision_model_output.attentions
								self.assertEqual(len(lowercase_						)						,     vision_config.num_hidden_layers						)

								# in DEiT, the seq_len equals the number of patches + 2 (we add 2 for the [CLS] and distillation tokens)
								UpperCAmelCase					:			Any									=						to_atuple(vision_model.config.image_size						)
								UpperCAmelCase					:			Union[str, Any]									=						to_atuple(vision_model.config.patch_size						)
								UpperCAmelCase					:			str									=						(image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])
								UpperCAmelCase					:			List[str]									=						num_patches + 2
								self.assertEqual(vision_attentions[0].shape[-3:]						,     (vision_config.num_attention_heads, seq_len, seq_len)						)

								UpperCAmelCase					:			Dict									=						output.text_model_output.attentions
								self.assertEqual(len(lowercase_						)						,     text_config.num_hidden_layers						)

								self.assertEqual(
								    text_attentions[0].shape[-3:]						,     (text_config.num_attention_heads, input_ids.shape[-1], input_ids.shape[-1])						,     )







	def 	A      (		self     :	List[str]						,     __snake_case     :	Union[str, Any]						,     __snake_case     :	Union[str, Any]						)     ->						Tuple:
								UpperCAmelCase					:			Any									=						TFDeiTModel(lowercase_						,     name='''vision_model'''						)
								UpperCAmelCase					:			str									=						TFRobertaModel(lowercase_						,     name='''text_model'''						)
								return vision_model, text_model







	def 	A      (		self     :	List[str]						)     ->						int:
								UpperCAmelCase					:			str									=						TFDeiTModelTester(self						)
								UpperCAmelCase					:			str									=						TFRobertaModelTester(self						)
								UpperCAmelCase					:			Optional[int]									=						vit_model_tester.prepare_config_and_inputs()
								UpperCAmelCase					:			str									=						bert_model_tester.prepare_config_and_inputs()

								UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase					:			Dict									=						vision_config_and_inputs

								(
								    (
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,												
								)					:			int									=						text_config_and_inputs

								return {
								    "text_config": text_config,
								    "vision_config": vision_config,
								    "pixel_values": pixel_values,
								    "attention_mask": input_mask,
								    "input_ids": input_ids,
								    "text_token_type_ids": token_type_ids,
								    "text_sequence_labels": sequence_labels,
								    "text_token_labels": token_labels,
								    "text_choice_labels": choice_labels,
								}

@require_tf
class 							SCREAMING_SNAKE_CASE(				A__				,						unittest.TestCase     ):







	"""simple docstring"""






	def 	A      (		self     :	List[str]						)     ->						List[Any]:
								UpperCAmelCase					:			Any									=						TFVisionTextDualEncoderModel.from_vision_text_pretrained(
								    '''Rocketknight1/tiny-random-clip-tf'''						,     '''hf-internal-testing/tiny-random-bert'''						)
								UpperCAmelCase					:			List[str]									=						13
								UpperCAmelCase					:			str									=						floats_tensor(
								    [
								        batch_size,
								        model.vision_model.config.num_channels,
								        model.vision_model.config.image_size,
								        model.vision_model.config.image_size,
								    ]						)
								UpperCAmelCase					:			Optional[int]									=						ids_tensor([batch_size, 4]						,     model.text_model.config.vocab_size						)
								UpperCAmelCase					:			List[Any]									=						random_attention_mask([batch_size, 4]						)
								UpperCAmelCase					:			Optional[Any]									=						{'''pixel_values''': pixel_values, '''input_ids''': input_ids, '''attention_mask''': attention_mask}

								return model, inputs







	def 	A      (		self     :	List[Any]						,     __snake_case     :	List[Any]						,     __snake_case     :	Any						)     ->						Optional[Any]:
								UpperCAmelCase					:			List[Any]									=						TFCLIPVisionModel(lowercase_						,     name='''vision_model'''						)
								UpperCAmelCase					:			Optional[int]									=						TFBertModel(lowercase_						,     name='''text_model'''						)
								return vision_model, text_model







	def 	A      (		self     :	str						)     ->						Optional[Any]:
								UpperCAmelCase					:			Any									=						TFCLIPVisionModelTester(self						)
								UpperCAmelCase					:			List[str]									=						TFBertModelTester(self						)
								UpperCAmelCase					:			Dict									=						clip_model_tester.prepare_config_and_inputs()
								UpperCAmelCase					:			Dict									=						bert_model_tester.prepare_config_and_inputs()

								UpperCAmelCase				,						UpperCAmelCase					:			Union[str, Any]									=						vision_config_and_inputs

								(
								    (
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,						(
								    UpperCAmelCase						
								)				,												
								)					:			Optional[Any]									=						text_config_and_inputs

								return {
								    "text_config": text_config,
								    "vision_config": vision_config,
								    "pixel_values": pixel_values,
								    "attention_mask": input_mask,
								    "input_ids": input_ids,
								    "text_token_type_ids": token_type_ids,
								    "text_sequence_labels": sequence_labels,
								    "text_token_labels": token_labels,
								    "text_choice_labels": choice_labels,
								}

@require_vision
@require_tf
class 							SCREAMING_SNAKE_CASE(				unittest.TestCase     ):







	"""simple docstring"""






	@slow
	def 	A      (		self     :	List[str]						)     ->						int:
								UpperCAmelCase					:			Optional[Any]									=						TFVisionTextDualEncoderModel.from_pretrained(
								    '''clip-italian/clip-italian'''						,     logit_scale_init_value=1.0						,     from_pt=lowercase_						)
								UpperCAmelCase					:			List[Any]									=						VisionTextDualEncoderProcessor.from_pretrained('''clip-italian/clip-italian'''						)

								UpperCAmelCase					:			Tuple									=						Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''						)
								UpperCAmelCase					:			Any									=						processor(
								    text=['''una foto di un gatto''', '''una foto di un cane''']						,     images=lowercase_						,     padding=lowercase_						,     return_tensors='''np'''						)

								UpperCAmelCase					:			Optional[int]									=						model(**lowercase_						)

								# verify the logits
								self.assertEqual(outputs.logits_per_image.shape						,     (inputs.pixel_values.shape[0], inputs.input_ids.shape[0])						)
								self.assertEqual(
								    outputs.logits_per_text.shape						,     (inputs.input_ids.shape[0], inputs.pixel_values.shape[0])						,     )

								UpperCAmelCase					:			Union[str, Any]									=						np.array([[1.2_28_47_27, 0.3_10_41_22]]						)

								self.assertTrue(np.allclose(outputs.logits_per_image.numpy()						,     lowercase_						,     atol=1E-3						)						)






from typing import TYPE_CHECKING

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


lowerCamelCase__  =					{
    '''configuration_wav2vec2''': ['''WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Wav2Vec2Config'''],
    '''feature_extraction_wav2vec2''': ['''Wav2Vec2FeatureExtractor'''],
    '''processing_wav2vec2''': ['''Wav2Vec2Processor'''],
    '''tokenization_wav2vec2''': ['''Wav2Vec2CTCTokenizer''', '''Wav2Vec2Tokenizer'''],
}


try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__  =					[
       '''WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''Wav2Vec2ForAudioFrameClassification''',
       '''Wav2Vec2ForCTC''',
       '''Wav2Vec2ForMaskedLM''',
       '''Wav2Vec2ForPreTraining''',
       '''Wav2Vec2ForSequenceClassification''',
       '''Wav2Vec2ForXVector''',
       '''Wav2Vec2Model''',
       '''Wav2Vec2PreTrainedModel''',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__  =					[
       '''TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFWav2Vec2ForCTC''',
       '''TFWav2Vec2Model''',
       '''TFWav2Vec2PreTrainedModel''',
       '''TFWav2Vec2ForSequenceClassification''',
   ]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__  =					[
       '''FlaxWav2Vec2ForCTC''',
       '''FlaxWav2Vec2ForPreTraining''',
       '''FlaxWav2Vec2Model''',
       '''FlaxWav2Vec2PreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_wavaveca import WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP, WavaVecaConfig
   from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
   from .processing_wavaveca import WavaVecaProcessor
   from .tokenization_wavaveca import WavaVecaCTCTokenizer, WavaVecaTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_wavaveca import (
          WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
          WavaVecaForAudioFrameClassification,
          WavaVecaForCTC,
          WavaVecaForMaskedLM,
          WavaVecaForPreTraining,
          WavaVecaForSequenceClassification,
          WavaVecaForXVector,
          WavaVecaModel,
          WavaVecaPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_wavaveca import (
          TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFWavaVecaForCTC,
          TFWavaVecaForSequenceClassification,
          TFWavaVecaModel,
          TFWavaVecaPreTrainedModel,
      )

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_wavaveca import (
          FlaxWavaVecaForCTC,
          FlaxWavaVecaForPreTraining,
          FlaxWavaVecaModel,
          FlaxWavaVecaPreTrainedModel,
      )


else:
   import sys

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




