



"""simple docstring"""
import inspect
import unittest
from typing import List

import numpy as np

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

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


if is_tf_available():
      import tensorflow as tf

      from transformers import (
          TFEfficientFormerForImageClassification,
          TFEfficientFormerForImageClassificationWithTeacher,
          TFEfficientFormerModel,
      )
      from transformers.models.efficientformer.modeling_tf_efficientformer import (
          TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      )


if is_vision_available():
      from PIL import Image

      from transformers import EfficientFormerImageProcessor



class    SCREAMING_SNAKE_CASE__						:

   def __init__(     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE = 13   ,  _SCREAMING_SNAKE_CASE = 64   ,  _SCREAMING_SNAKE_CASE = 2   ,  _SCREAMING_SNAKE_CASE = 3   ,  _SCREAMING_SNAKE_CASE = 3   ,  _SCREAMING_SNAKE_CASE = True   ,  _SCREAMING_SNAKE_CASE = True   ,  _SCREAMING_SNAKE_CASE = 128   ,  _SCREAMING_SNAKE_CASE=[16, 32, 64, 128]   ,  _SCREAMING_SNAKE_CASE = 7   ,  _SCREAMING_SNAKE_CASE = 4   ,  _SCREAMING_SNAKE_CASE = 37   ,  _SCREAMING_SNAKE_CASE = "gelu"   ,  _SCREAMING_SNAKE_CASE = 0.1   ,  _SCREAMING_SNAKE_CASE = 0.1   ,  _SCREAMING_SNAKE_CASE = 10   ,  _SCREAMING_SNAKE_CASE = 0.02   ,  _SCREAMING_SNAKE_CASE = 2   ,  _SCREAMING_SNAKE_CASE = 1   ,  _SCREAMING_SNAKE_CASE = 128   ,  _SCREAMING_SNAKE_CASE = [2, 2, 2, 2]   ,  _SCREAMING_SNAKE_CASE = 2   ,  _SCREAMING_SNAKE_CASE = 2   ,  )						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Optional[Any]			=			parent
    UpperCAmelCase			:      int			=			batch_size
    UpperCAmelCase			:      Optional[int]			=			image_size
    UpperCAmelCase			:      Any			=			patch_size
    UpperCAmelCase			:      List[Any]			=			num_channels
    UpperCAmelCase			:      List[Any]			=			is_training
    UpperCAmelCase			:      Dict			=			use_labels
    UpperCAmelCase			:      Dict			=			hidden_size
    UpperCAmelCase			:      Tuple			=			num_hidden_layers
    UpperCAmelCase			:      Dict			=			num_attention_heads
    UpperCAmelCase			:      Union[str, Any]			=			intermediate_size
    UpperCAmelCase			:      Optional[int]			=			hidden_act
    UpperCAmelCase			:      Dict			=			hidden_dropout_prob
    UpperCAmelCase			:      str			=			attention_probs_dropout_prob
    UpperCAmelCase			:      List[Any]			=			type_sequence_label_size
    UpperCAmelCase			:      int			=			initializer_range
    UpperCAmelCase			:      Tuple			=			encoder_stride
    UpperCAmelCase			:      List[str]			=			num_attention_outputs
    UpperCAmelCase			:      Optional[Any]			=			embed_dim
    UpperCAmelCase			:      Any			=			embed_dim + 1
    UpperCAmelCase			:      Optional[Any]			=			resolution
    UpperCAmelCase			:      List[Any]			=			depths
    UpperCAmelCase			:      Any			=			hidden_sizes
    UpperCAmelCase			:      Any			=			dim
    UpperCAmelCase			:      Tuple			=			mlp_expansion_ratio

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Optional[Any]			=			floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]		)

    UpperCAmelCase			:      Dict			=			None
    if self.use_labels:
     UpperCAmelCase			:      Dict			=			ids_tensor([self.batch_size]   ,  self.type_sequence_label_size		)

    UpperCAmelCase			:      Optional[int]			=			self.get_config()

    return config, pixel_values, labels

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Any:





    '''simple docstring'''




    return EfficientFormerConfig(
        image_size=self.image_size   ,  patch_size=self.patch_size   ,  num_channels=self.num_channels   ,  hidden_size=self.hidden_size   ,  num_hidden_layers=self.num_hidden_layers   ,  num_attention_heads=self.num_attention_heads   ,  intermediate_size=self.intermediate_size   ,  hidden_act=self.hidden_act   ,  hidden_dropout_prob=self.hidden_dropout_prob   ,  attention_probs_dropout_prob=self.attention_probs_dropout_prob   ,  is_decoder=_SCREAMING_SNAKE_CASE   ,  initializer_range=self.initializer_range   ,  encoder_stride=self.encoder_stride   ,  resolution=self.resolution   ,  depths=self.depths   ,  hidden_sizes=self.hidden_sizes   ,  dim=self.dim   ,  mlp_expansion_ratio=self.mlp_expansion_ratio   ,  )

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)						->   Optional[int]:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			TFEfficientFormerModel(config=_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Optional[int]			=			model(_SCREAMING_SNAKE_CASE   ,  training=_SCREAMING_SNAKE_CASE		)
    self.parent.assertEqual(result.last_hidden_state.shape   ,  (self.batch_size, self.seq_length, self.hidden_size)		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)						->   Any:





    '''simple docstring'''




    UpperCAmelCase			:      Union[str, Any]			=			self.type_sequence_label_size
    UpperCAmelCase			:      List[Any]			=			TFEfficientFormerForImageClassification(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Union[str, Any]			=			model(_SCREAMING_SNAKE_CASE   ,  labels=_SCREAMING_SNAKE_CASE   ,  training=_SCREAMING_SNAKE_CASE		)
    self.parent.assertEqual(result.logits.shape   ,  (self.batch_size, self.type_sequence_label_size)		)

    # test greyscale images
    UpperCAmelCase			:      List[str]			=			1
    UpperCAmelCase			:      Tuple			=			TFEfficientFormerForImageClassification(_SCREAMING_SNAKE_CASE		)

    UpperCAmelCase			:      Tuple			=			floats_tensor([self.batch_size, 1, self.image_size, self.image_size]		)
    UpperCAmelCase			:      Tuple			=			model(_SCREAMING_SNAKE_CASE   ,  labels=_SCREAMING_SNAKE_CASE		)
    self.parent.assertEqual(result.logits.shape   ,  (self.batch_size, self.type_sequence_label_size)		)




   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[str]:





    '''simple docstring'''




    UpperCAmelCase			:      List[Any]			=			self.prepare_config_and_inputs()
    UpperCAmelCase			,	UpperCAmelCase			,	UpperCAmelCase			:      int			=			config_and_inputs
    UpperCAmelCase			:      Tuple			=			{"""pixel_values""": pixel_values}
    return config, inputs_dict



@require_tf
class    SCREAMING_SNAKE_CASE__						(      UpperCAmelCase__   ,    UpperCAmelCase__   ,    unittest.TestCase				):
   __lowerCAmelCase						:     List[str]		=		(
       (
           TFEfficientFormerModel,
           TFEfficientFormerForImageClassificationWithTeacher,
           TFEfficientFormerForImageClassification,
       )
       if is_tf_available()
       else ()
   )
   __lowerCAmelCase						:     Any		=		(
       {
           'feature-extraction': TFEfficientFormerModel,
           'image-classification': (
               TFEfficientFormerForImageClassification,
               TFEfficientFormerForImageClassificationWithTeacher,
           ),
       }
       if is_tf_available()
       else {}
   )

   __lowerCAmelCase						:     Union[str, Any]		=		False

   __lowerCAmelCase						:     List[Any]		=		False
   __lowerCAmelCase						:     str		=		False
   __lowerCAmelCase						:     List[Any]		=		False
   __lowerCAmelCase						:     List[Any]		=		False

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[str]:





    '''simple docstring'''




    UpperCAmelCase			:      List[str]			=			TFEfficientFormerModelTester(self		)
    UpperCAmelCase			:      Union[str, Any]			=			ConfigTester(
        self   ,  config_class=_SCREAMING_SNAKE_CASE   ,  has_text_modality=_SCREAMING_SNAKE_CASE   ,  hidden_size=37		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   int:





    '''simple docstring'''




    self.config_tester.run_common_tests()

   @unittest.skip(reason="""EfficientFormer does not use inputs_embeds"""		)
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Tuple:





    '''simple docstring'''




    pass

   @unittest.skip(reason="""EfficientFormer does not support input and output embeddings"""		)
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Optional[Any]:





    '''simple docstring'''




    pass

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			,	UpperCAmelCase			:      Optional[Any]			=			self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     UpperCAmelCase			:      List[Any]			=			model_class(_SCREAMING_SNAKE_CASE		)
     UpperCAmelCase			:      Dict			=			inspect.signature(model.call		)
     # signature.parameters is an OrderedDict => so arg_names order is deterministic
     UpperCAmelCase			:      List[str]			=			[*signature.parameters.keys()]

     UpperCAmelCase			:      int			=			["""pixel_values"""]
     self.assertListEqual(arg_names[:1]   ,  _SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Any:





    '''simple docstring'''




    def check_hidden_states_output(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		):
     UpperCAmelCase			:      Union[str, Any]			=			model_class(_SCREAMING_SNAKE_CASE		)

     UpperCAmelCase			:      str			=			model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)   ,  training=_SCREAMING_SNAKE_CASE		)
     UpperCAmelCase			:      Optional[Any]			=			outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

     UpperCAmelCase			:      str			=			getattr(
         self.model_tester   ,  """expected_num_hidden_layers"""   ,  self.model_tester.num_hidden_layers + 1		)
     self.assertEqual(len(_SCREAMING_SNAKE_CASE		)   ,  _SCREAMING_SNAKE_CASE		)

     if hasattr(self.model_tester   ,  """encoder_seq_length"""		):
      UpperCAmelCase			:      Any			=			self.model_tester.encoder_seq_length
      if hasattr(self.model_tester   ,  """chunk_length"""		) and self.model_tester.chunk_length > 1:
       UpperCAmelCase			:      Dict			=			seq_length * self.model_tester.chunk_length
     else:
      UpperCAmelCase			:      Any			=			self.model_tester.seq_length

     self.assertListEqual(
         list(hidden_states[-1].shape[-2:]		)   ,  [seq_length, self.model_tester.hidden_size]   ,  )

     if config.is_encoder_decoder:
      UpperCAmelCase			:      int			=			outputs.decoder_hidden_states

      self.asseretIsInstance(_SCREAMING_SNAKE_CASE   ,  (list, tuple)		)
      self.assertEqual(len(_SCREAMING_SNAKE_CASE		)   ,  _SCREAMING_SNAKE_CASE		)
      UpperCAmelCase			:      List[Any]			=			getattr(self.model_tester   ,  """seq_length"""   ,  _SCREAMING_SNAKE_CASE		)
      UpperCAmelCase			:      List[str]			=			getattr(self.model_tester   ,  """decoder_seq_length"""   ,  _SCREAMING_SNAKE_CASE		)

      self.assertListEqual(
          list(hidden_states[-1].shape[-2:]		)   ,  [decoder_seq_length, self.model_tester.hidden_size]   ,  )

    UpperCAmelCase			,	UpperCAmelCase			:      Optional[int]			=			self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     UpperCAmelCase			:      Any			=			True
     check_hidden_states_output(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)

     # check that output_hidden_states also work using config
     del inputs_dict["output_hidden_states"]
     UpperCAmelCase			:      int			=			True

     check_hidden_states_output(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE=False		)						->   Tuple:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			super()._prepare_for_class(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE   ,  return_labels=_SCREAMING_SNAKE_CASE		)

    if return_labels:
     if model_class.__name__ == "TFEfficientFormerForImageClassificationWithTeacher":
      del inputs_dict["labels"]

    return inputs_dict

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   str:





    '''simple docstring'''




    UpperCAmelCase			:      Dict			=			self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE		)

   @unittest.skip(reason="""EfficientFormer does not implement masked image modeling yet"""		)
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Tuple:





    '''simple docstring'''




    UpperCAmelCase			:      Tuple			=			self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_masked_image_modeling(*_SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase			:      Tuple			=			self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_image_classification(*_SCREAMING_SNAKE_CASE		)

   @slow
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Optional[Any]:





    '''simple docstring'''




    for model_name in TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     UpperCAmelCase			:      int			=			TFEfficientFormerModel.from_pretrained(_SCREAMING_SNAKE_CASE		)
     self.assertIsNotNone(_SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[str]:





    '''simple docstring'''




    UpperCAmelCase			,	UpperCAmelCase			:      List[str]			=			self.model_tester.prepare_config_and_inputs_for_common()
    UpperCAmelCase			:      Optional[Any]			=			True

    UpperCAmelCase			:      Tuple			=			getattr(self.model_tester   ,  """seq_length"""   ,  _SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Any			=			getattr(self.model_tester   ,  """encoder_seq_length"""   ,  _SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      int			=			getattr(self.model_tester   ,  """key_length"""   ,  _SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Optional[int]			=			getattr(self.model_tester   ,  """chunk_length"""   ,  _SCREAMING_SNAKE_CASE		)

    if chunk_length is not None and hasattr(self.model_tester   ,  """num_hashes"""		):
     UpperCAmelCase			:      int			=			encoder_seq_length * self.model_tester.num_hashes

    for model_class in self.all_model_classes:
     UpperCAmelCase			:      List[Any]			=			True
     UpperCAmelCase			:      int			=			False
     UpperCAmelCase			:      Any			=			True
     UpperCAmelCase			:      List[str]			=			model_class(_SCREAMING_SNAKE_CASE		)

     UpperCAmelCase			:      Optional[int]			=			model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)   ,  training=_SCREAMING_SNAKE_CASE		)
     UpperCAmelCase			:      str			=			outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
     self.assertEqual(len(_SCREAMING_SNAKE_CASE		)   ,  self.model_tester.num_attention_outputs		)

     # check that output_attentions also work using config
     del inputs_dict["output_attentions"]
     UpperCAmelCase			:      Optional[Any]			=			True
     UpperCAmelCase			:      List[Any]			=			model_class(_SCREAMING_SNAKE_CASE		)
     UpperCAmelCase			:      Optional[int]			=			model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)   ,  training=_SCREAMING_SNAKE_CASE		)

     UpperCAmelCase			:      List[str]			=			outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
     self.assertEqual(len(_SCREAMING_SNAKE_CASE		)   ,  self.model_tester.num_attention_outputs		)

     if chunk_length is not None:
      self.assertListEqual(
          list(attentions[0].shape[-4:]		)   ,  [self.model_tester.num_attention_heads, encoder_seq_length, chunk_length, encoder_key_length]   ,  )
     else:
      self.assertListEqual(
          list(attentions[0].shape[-3:]		)   ,  [self.model_tester.num_attention_heads, encoder_seq_length, encoder_key_length]   ,  )




   def 			SCREAMING_SNAKE_CASE  (     self		)						->   List[Any]:





    '''simple docstring'''




    UpperCAmelCase			,	UpperCAmelCase			:      List[str]			=			self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     # Prepare our model
     UpperCAmelCase			:      Union[str, Any]			=			model_class(_SCREAMING_SNAKE_CASE		)
     # These are maximally general inputs for the model, with multiple None dimensions
     # Hopefully this will catch any conditionals that fail for flexible shapes
     UpperCAmelCase			:      Optional[int]			=			{
         key: tf.keras.Input(shape=val.shape[1:]   ,  dtype=val.dtype   ,  name=_SCREAMING_SNAKE_CASE		)
         for key, val in model.input_signature.items()
         if key in model.dummy_inputs
     }
     UpperCAmelCase			:      List[str]			=			model(_SCREAMING_SNAKE_CASE		)
     self.assertTrue(outputs_dict is not None		)

def    _snake_case		(		):
 UpperCAmelCase			:      Optional[int]			=			Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""		)
 return image



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

   @cached_property
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Dict:





    '''simple docstring'''




    return (
        EfficientFormerImageProcessor.from_pretrained("""snap-research/efficientformer-l1-300"""		)
        if is_vision_available()
        else None
    )

   @slow
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Any:





    '''simple docstring'''




    UpperCAmelCase			:      List[str]			=			TFEfficientFormerForImageClassification.from_pretrained("""snap-research/efficientformer-l1-300"""		)
    UpperCAmelCase			:      Tuple			=			self.default_image_processor
    UpperCAmelCase			:      Any			=			prepare_img()
    UpperCAmelCase			:      Any			=			image_processor(images=_SCREAMING_SNAKE_CASE   ,  return_tensors="""tf"""		)
    # forward pass
    UpperCAmelCase			:      Any			=			model(**_SCREAMING_SNAKE_CASE   ,  training=_SCREAMING_SNAKE_CASE		)
    # verify the logits
    UpperCAmelCase			:      Any			=			tf.TensorShape((1, 1000)		)
    self.assertEqual(outputs.logits.shape   ,  _SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      int			=			tf.constant([-0.0555, 0.4825, -0.0852]		)
    self.assertTrue(np.allclose(outputs.logits[0, :3]   ,  _SCREAMING_SNAKE_CASE   ,  atol=1E-4		)		)




   @slow
   def 			SCREAMING_SNAKE_CASE  (     self		)						->   Any:





    '''simple docstring'''




    UpperCAmelCase			:      str			=			TFEfficientFormerForImageClassificationWithTeacher.from_pretrained(
        """snap-research/efficientformer-l1-300"""		)
    UpperCAmelCase			:      Optional[int]			=			self.default_image_processor
    UpperCAmelCase			:      Dict			=			prepare_img()
    UpperCAmelCase			:      Any			=			image_processor(images=_SCREAMING_SNAKE_CASE   ,  return_tensors="""tf"""		)
    # forward pass
    UpperCAmelCase			:      List[Any]			=			model(**_SCREAMING_SNAKE_CASE   ,  training=_SCREAMING_SNAKE_CASE		)
    # verify the logits
    UpperCAmelCase			:      Dict			=			tf.TensorShape((1, 1000)		)
    self.assertEqual(outputs.logits.shape   ,  _SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Dict			=			tf.constant([-0.1312, 0.4353, -1.0499]		)
    self.assertTrue(np.allclose(outputs.logits[0, :3]   ,  _SCREAMING_SNAKE_CASE   ,  atol=1E-4		)		)





"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_torch_available,
)


A:     Union[str, Any]										=	{
    "configuration_speecht5": [
        "SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP",
        "SpeechT5Config",
        "SpeechT5HifiGanConfig",
    ],
    "feature_extraction_speecht5": ["SpeechT5FeatureExtractor"],
    "processing_speecht5": ["SpeechT5Processor"],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A:     List[str]										=	["SpeechT5Tokenizer"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A:     Dict										=	[
          "SPEECHT5_PRETRAINED_MODEL_ARCHIVE_LIST",
          "SpeechT5ForSpeechToText",
          "SpeechT5ForSpeechToSpeech",
          "SpeechT5ForTextToSpeech",
          "SpeechT5Model",
          "SpeechT5PreTrainedModel",
          "SpeechT5HifiGan",
      ]

if TYPE_CHECKING:
      from .configuration_speechta import (
          SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP,
          SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP,
          SpeechTaConfig,
          SpeechTaHifiGanConfig,
      )
      from .feature_extraction_speechta import SpeechTaFeatureExtractor
      from .processing_speechta import SpeechTaProcessor

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_speechta import SpeechTaTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_speechta import (
                SPEECHT5_PRETRAINED_MODEL_ARCHIVE_LIST,
                SpeechTaForSpeechToSpeech,
                SpeechTaForSpeechToText,
                SpeechTaForTextToSpeech,
                SpeechTaHifiGan,
                SpeechTaModel,
                SpeechTaPreTrainedModel,
            )

else:
      import sys

      A:     Dict										=	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
