'''simple docstring'''

import os
import tempfile
import unittest

from transformers import FlaubertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
       import torch

       from transformers import (
           FlaubertForMultipleChoice,
           FlaubertForQuestionAnswering,
           FlaubertForQuestionAnsweringSimple,
           FlaubertForSequenceClassification,
           FlaubertForTokenClassification,
           FlaubertModel,
           FlaubertWithLMHeadModel,
       )
       from transformers.models.flaubert.modeling_flaubert import FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST





class 							lowercase						(						__lowerCamelCase ):


   def __init__(   self				:	Optional[Any]   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	int=13   ,		__lowerCAmelCase				:	Union[str, Any]=7   ,		__lowerCAmelCase				:	str=True   ,		__lowerCAmelCase				:	Union[str, Any]=True   ,		__lowerCAmelCase				:	int=True   ,		__lowerCAmelCase				:	Optional[Any]=True   ,		__lowerCAmelCase				:	Union[str, Any]=True   ,		__lowerCAmelCase				:	Dict=False   ,		__lowerCAmelCase				:	Union[str, Any]=False   ,		__lowerCAmelCase				:	List[str]=False   ,		__lowerCAmelCase				:	int=2   ,		__lowerCAmelCase				:	Any=99   ,		__lowerCAmelCase				:	int=0   ,		__lowerCAmelCase				:	Union[str, Any]=32   ,		__lowerCAmelCase				:	str=5   ,		__lowerCAmelCase				:	List[Any]=4   ,		__lowerCAmelCase				:	str=0.1   ,		__lowerCAmelCase				:	List[Any]=0.1   ,		__lowerCAmelCase				:	Union[str, Any]=512   ,		__lowerCAmelCase				:	List[Any]=12   ,		__lowerCAmelCase				:	List[str]=2   ,		__lowerCAmelCase				:	Optional[Any]=0.02   ,		__lowerCAmelCase				:	Optional[int]=3   ,		__lowerCAmelCase				:	int=4   ,		__lowerCAmelCase				:	List[str]="last"   ,		__lowerCAmelCase				:	Union[str, Any]=None   ,		__lowerCAmelCase				:	Dict=None   ,		)      ->					Tuple:
         lowercase_     =      parent
         lowercase_     =      batch_size
         lowercase_     =      seq_length
         lowercase_     =      is_training
         lowercase_     =      use_input_lengths
         lowercase_     =      use_token_type_ids
         lowercase_     =      use_labels
         lowercase_     =      gelu_activation
         lowercase_     =      sinusoidal_embeddings
         lowercase_     =      causal
         lowercase_     =      asm
         lowercase_     =      n_langs
         lowercase_     =      vocab_size
         lowercase_     =      n_special
         lowercase_     =      hidden_size
         lowercase_     =      num_hidden_layers
         lowercase_     =      num_attention_heads
         lowercase_     =      hidden_dropout_prob
         lowercase_     =      attention_probs_dropout_prob
         lowercase_     =      max_position_embeddings
         lowercase_     =      type_vocab_size
         lowercase_     =      type_sequence_label_size
         lowercase_     =      initializer_range
         lowercase_     =      num_labels
         lowercase_     =      num_choices
         lowercase_     =      summary_type
         lowercase_     =      use_proj
         lowercase_     =      scope


   def __UpperCAmelCase       (   self				:	List[Any])      ->					Tuple:
         lowercase_     =      ids_tensor([self.batch_size, self.seq_length]   ,		self.vocab_size)
         lowercase_     =      random_attention_mask([self.batch_size, self.seq_length])

         lowercase_     =      None
         if self.use_input_lengths:
               lowercase_     =      (
                   ids_tensor([self.batch_size]   ,		vocab_size=2) + self.seq_length - 2
               )  # small variation of seq_length

         lowercase_     =      None
         if self.use_token_type_ids:
               lowercase_     =      ids_tensor([self.batch_size, self.seq_length]   ,		self.n_langs)

         lowercase_     =      None
         lowercase_     =      None
         lowercase_     =      None
         if self.use_labels:
               lowercase_     =      ids_tensor([self.batch_size]   ,		self.type_sequence_label_size)
               lowercase_     =      ids_tensor([self.batch_size, self.seq_length]   ,		self.num_labels)
               lowercase_     =      ids_tensor([self.batch_size]   ,		2).float()
               lowercase_     =      ids_tensor([self.batch_size]   ,		self.num_choices)

         lowercase_     =      self.get_config()

         return (
             config,
             input_ids,
             token_type_ids,
             input_lengths,
             sequence_labels,
             token_labels,
             is_impossible_labels,
             choice_labels,
             input_mask,
         )


   def __UpperCAmelCase       (   self				:	Optional[int])      ->					Union[str, Any]:
         return FlaubertConfig(
             vocab_size=self.vocab_size   ,		n_special=self.n_special   ,		emb_dim=self.hidden_size   ,		n_layers=self.num_hidden_layers   ,		n_heads=self.num_attention_heads   ,		dropout=self.hidden_dropout_prob   ,		attention_dropout=self.attention_probs_dropout_prob   ,		gelu_activation=self.gelu_activation   ,		sinusoidal_embeddings=self.sinusoidal_embeddings   ,		asm=self.asm   ,		causal=self.causal   ,		n_langs=self.n_langs   ,		max_position_embeddings=self.max_position_embeddings   ,		initializer_range=self.initializer_range   ,		summary_type=self.summary_type   ,		use_proj=self.use_proj   ,		)


   def __UpperCAmelCase       (   self				:	Tuple   ,		__lowerCAmelCase				:	Optional[Any]   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	List[Any]   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	Optional[Any]   ,		__lowerCAmelCase				:	Optional[Any]   ,		__lowerCAmelCase				:	str   ,		)      ->					int:
         lowercase_     =      FlaubertModel(config=__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()
         lowercase_     =      model(__lowerCAmelCase   ,		lengths=__lowerCAmelCase   ,		langs=__lowerCAmelCase)
         lowercase_     =      model(__lowerCAmelCase   ,		langs=__lowerCAmelCase)
         lowercase_     =      model(__lowerCAmelCase)
         self.parent.assertEqual(result.last_hidden_state.shape   ,		(self.batch_size, self.seq_length, self.hidden_size))


   def __UpperCAmelCase       (   self				:	List[Any]   ,		__lowerCAmelCase				:	int   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	List[str]   ,		)      ->					str:
         lowercase_     =      FlaubertWithLMHeadModel(__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()

         lowercase_     =      model(__lowerCAmelCase   ,		token_type_ids=__lowerCAmelCase   ,		labels=__lowerCAmelCase)
         self.parent.assertEqual(result.loss.shape   ,		())
         self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.seq_length, self.vocab_size))


   def __UpperCAmelCase       (   self				:	Optional[Any]   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	Optional[Any]   ,		__lowerCAmelCase				:	List[Any]   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	str   ,		)      ->					str:
         lowercase_     =      FlaubertForQuestionAnsweringSimple(__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()

         lowercase_     =      model(__lowerCAmelCase)

         lowercase_     =      model(__lowerCAmelCase   ,		start_positions=__lowerCAmelCase   ,		end_positions=__lowerCAmelCase)
         self.parent.assertEqual(result.start_logits.shape   ,		(self.batch_size, self.seq_length))
         self.parent.assertEqual(result.end_logits.shape   ,		(self.batch_size, self.seq_length))


   def __UpperCAmelCase       (   self				:	Dict   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Tuple   ,		)      ->					Any:
         lowercase_     =      FlaubertForQuestionAnswering(__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()

         lowercase_     =      model(__lowerCAmelCase)

         lowercase_     =      model(
             __lowerCAmelCase   ,		start_positions=__lowerCAmelCase   ,		end_positions=__lowerCAmelCase   ,		cls_index=__lowerCAmelCase   ,		is_impossible=__lowerCAmelCase   ,		p_mask=__lowerCAmelCase   ,		)

         lowercase_     =      model(
             __lowerCAmelCase   ,		start_positions=__lowerCAmelCase   ,		end_positions=__lowerCAmelCase   ,		cls_index=__lowerCAmelCase   ,		is_impossible=__lowerCAmelCase   ,		)

         ((lowercase_) ,							)     =      result_with_labels.to_tuple()

         lowercase_     =      model(__lowerCAmelCase   ,		start_positions=__lowerCAmelCase   ,		end_positions=__lowerCAmelCase)

         ((lowercase_) ,							)     =      result_with_labels.to_tuple()

         self.parent.assertEqual(result_with_labels.loss.shape   ,		())
         self.parent.assertEqual(result.start_top_log_probs.shape   ,		(self.batch_size, model.config.start_n_top))
         self.parent.assertEqual(result.start_top_index.shape   ,		(self.batch_size, model.config.start_n_top))
         self.parent.assertEqual(
             result.end_top_log_probs.shape   ,		(self.batch_size, model.config.start_n_top * model.config.end_n_top))
         self.parent.assertEqual(
             result.end_top_index.shape   ,		(self.batch_size, model.config.start_n_top * model.config.end_n_top))
         self.parent.assertEqual(result.cls_logits.shape   ,		(self.batch_size,))


   def __UpperCAmelCase       (   self				:	Any   ,		__lowerCAmelCase				:	Optional[int]   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	List[Any]   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Optional[int]   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	List[str]   ,		)      ->					Tuple:
         lowercase_     =      FlaubertForSequenceClassification(__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()

         lowercase_     =      model(__lowerCAmelCase)
         lowercase_     =      model(__lowerCAmelCase   ,		labels=__lowerCAmelCase)

         self.parent.assertEqual(result.loss.shape   ,		())
         self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.type_sequence_label_size))


   def __UpperCAmelCase       (   self				:	Any   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	Optional[int]   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	Union[str, Any]   ,		__lowerCAmelCase				:	Tuple   ,		)      ->					Tuple:
         lowercase_     =      self.num_labels
         lowercase_     =      FlaubertForTokenClassification(__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()

         lowercase_     =      model(__lowerCAmelCase   ,		attention_mask=__lowerCAmelCase   ,		labels=__lowerCAmelCase)
         self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.seq_length, self.num_labels))


   def __UpperCAmelCase       (   self				:	Optional[int]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Dict   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	List[Any]   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	Optional[Any]   ,		__lowerCAmelCase				:	Dict   ,		)      ->					List[Any]:
         lowercase_     =      self.num_choices
         lowercase_     =      FlaubertForMultipleChoice(config=__lowerCAmelCase)
         model.to(__lowerCAmelCase)
         model.eval()
         lowercase_     =      input_ids.unsqueeze(1).expand(-1   ,		self.num_choices   ,		-1).contiguous()
         lowercase_     =      token_type_ids.unsqueeze(1).expand(-1   ,		self.num_choices   ,		-1).contiguous()
         lowercase_     =      input_mask.unsqueeze(1).expand(-1   ,		self.num_choices   ,		-1).contiguous()
         lowercase_     =      model(
             __lowerCAmelCase   ,		attention_mask=__lowerCAmelCase   ,		token_type_ids=__lowerCAmelCase   ,		labels=__lowerCAmelCase   ,		)
         self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.num_choices))


   def __UpperCAmelCase       (   self				:	List[Any])      ->					List[str]:
         lowercase_     =      self.prepare_config_and_inputs()
         (
             (
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							(
             lowercase_
         ) ,							
         )     =      config_and_inputs
         lowercase_     =      {
             "input_ids": input_ids,
             "token_type_ids": token_type_ids,
             "lengths": input_lengths,
             "attention_mask": input_mask,
         }
         return config, inputs_dict





@require_torch
class 							lowercase						(						__lowerCamelCase ,				__lowerCamelCase ,				unittest.TestCase ):
   lowerCamelCase_    					=(
       (
           FlaubertModel,
           FlaubertWithLMHeadModel,
           FlaubertForQuestionAnswering,
           FlaubertForQuestionAnsweringSimple,
           FlaubertForSequenceClassification,
           FlaubertForTokenClassification,
           FlaubertForMultipleChoice,
       )
       if is_torch_available()
       else ()
   )
   lowerCamelCase_    					=(
       {
           'feature-extraction': FlaubertModel,
           'fill-mask': FlaubertWithLMHeadModel,
           'question-answering': FlaubertForQuestionAnsweringSimple,
           'text-classification': FlaubertForSequenceClassification,
           'token-classification': FlaubertForTokenClassification,
           'zero-shot': FlaubertForSequenceClassification,
       }
       if is_torch_available()
       else {}
   )


   def __UpperCAmelCase       (   self				:	Tuple   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	int   ,		__lowerCAmelCase				:	Tuple   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	int)      ->					Optional[int]:
         if (
             pipeline_test_casse_name == "QAPipelineTests"
             and tokenizer_name is not None
             and not tokenizer_name.endswith("Fast")
         ):
               # `QAPipelineTests` fails for a few models when the slower tokenizer are used.
               # (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
               # TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
               return True

         return False


   def __UpperCAmelCase       (   self				:	Dict   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	Any   ,		__lowerCAmelCase				:	List[str]=False)      ->					Optional[Any]:
         lowercase_     =      super()._prepare_for_class(__lowerCAmelCase   ,		__lowerCAmelCase   ,		return_labels=__lowerCAmelCase)

         if return_labels:
               if model_class.__name__ == "FlaubertForQuestionAnswering":
                     lowercase_     =      torch.zeros(
                         self.model_tester.batch_size   ,		dtype=torch.long   ,		device=__lowerCAmelCase)
                     lowercase_     =      torch.zeros(
                         self.model_tester.batch_size   ,		dtype=torch.long   ,		device=__lowerCAmelCase)

         return inputs_dict


   def __UpperCAmelCase       (   self				:	Optional[int])      ->					Dict:
         lowercase_     =      FlaubertModelTester(self)
         lowercase_     =      ConfigTester(self   ,		config_class=__lowerCAmelCase   ,		emb_dim=37)


   def __UpperCAmelCase       (   self				:	str)      ->					int:
         self.config_tester.run_common_tests()


   def __UpperCAmelCase       (   self				:	Any)      ->					Optional[Any]:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_model(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	int)      ->					Union[str, Any]:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_lm_head(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	Any)      ->					int:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_simple_qa(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	List[str])      ->					List[str]:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_qa(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	int)      ->					Union[str, Any]:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_sequence_classif(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	Optional[int])      ->					int:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_token_classif(*__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	Optional[Any])      ->					Tuple:
         lowercase_     =      self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_flaubert_multiple_choice(*__lowerCAmelCase)


   @slow
   def __UpperCAmelCase       (   self				:	Any)      ->					Dict:
         for model_name in FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowercase_     =      FlaubertModel.from_pretrained(__lowerCAmelCase)
               self.assertIsNotNone(__lowerCAmelCase)


   @slow
   @require_torch_gpu
   def __UpperCAmelCase       (   self				:	Dict)      ->					int:
         lowercase_ ,							lowercase_     =      self.model_tester.prepare_config_and_inputs_for_common()
         for model_class in self.all_model_classes:
               # FlauBertForMultipleChoice behaves incorrectly in JIT environments.
               if model_class == FlaubertForMultipleChoice:
                     return

               lowercase_     =      True
               lowercase_     =      model_class(config=__lowerCAmelCase)

               lowercase_     =      self._prepare_for_class(__lowerCAmelCase   ,		__lowerCAmelCase)
               lowercase_     =      torch.jit.trace(
                   __lowerCAmelCase   ,		(inputs_dict["input_ids"].to("cpu"), inputs_dict["attention_mask"].to("cpu")))

               with tempfile.TemporaryDirectory() as tmp:
                     torch.jit.save(__lowerCAmelCase   ,		os.path.join(__lowerCAmelCase   ,		"traced_model.pt"))
                     lowercase_     =      torch.jit.load(os.path.join(__lowerCAmelCase   ,		"traced_model.pt")   ,		map_location=__lowerCAmelCase)
                     loaded(inputs_dict["input_ids"].to(__lowerCAmelCase)   ,		inputs_dict["attention_mask"].to(__lowerCAmelCase))





@require_torch
class 							lowercase						(						unittest.TestCase ):


   @slow
   def __UpperCAmelCase       (   self				:	Tuple)      ->					Union[str, Any]:
         lowercase_     =      FlaubertModel.from_pretrained("flaubert/flaubert_base_cased")
         lowercase_     =      torch.tensor([[0, 345, 232, 328, 740, 140, 1695, 69, 6078, 1588, 2]])
         with torch.no_grad():
               lowercase_     =      model(__lowerCAmelCase)[0]
         lowercase_     =      torch.Size((1, 11, 768))
         self.assertEqual(output.shape   ,		__lowerCAmelCase)
         lowercase_     =      torch.tensor(
             [[[-2.6251, -1.4298, -0.0227], [-2.8510, -1.6387, 0.2258], [-2.8114, -1.1832, -0.3066]]])

         self.assertTrue(torch.allclose(output[:, :3, :3]   ,		__lowerCAmelCase   ,		atol=1e-4))







'''simple docstring'''

from typing import TYPE_CHECKING

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


lowerCAmelCase_ : str						  =      {
    "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_ : Union[str, Any]						  =      [
           "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_ : int						  =      [
           "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_ : Dict						  =      [
           "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_ : Optional[int]						  =      _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)






