



"""simple docstring"""
from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
       from transformers import (
           AutoConfig,
           BertConfig,
           GPTaConfig,
           TaConfig,
           TFAutoModel,
           TFAutoModelForCausalLM,
           TFAutoModelForMaskedLM,
           TFAutoModelForPreTraining,
           TFAutoModelForQuestionAnswering,
           TFAutoModelForSeqaSeqLM,
           TFAutoModelForSequenceClassification,
           TFAutoModelWithLMHead,
           TFBertForMaskedLM,
           TFBertForPreTraining,
           TFBertForQuestionAnswering,
           TFBertForSequenceClassification,
           TFBertModel,
           TFGPTaLMHeadModel,
           TFRobertaForMaskedLM,
           TFTaForConditionalGeneration,
       )
       from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
       from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
       from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
       from transformers import (
           AutoModel,
           AutoModelForCausalLM,
           AutoModelForMaskedLM,
           AutoModelForPreTraining,
           AutoModelForQuestionAnswering,
           AutoModelForSeqaSeqLM,
           AutoModelForSequenceClassification,
           AutoModelWithLMHead,
           BertForMaskedLM,
           BertForPreTraining,
           BertForQuestionAnswering,
           BertForSequenceClassification,
           BertModel,
           GPTaLMHeadModel,
           RobertaForMaskedLM,
           TaForConditionalGeneration,
       )


@is_pt_tf_cross_test
class    SCREAMING_SNAKE_CASE__ (							unittest.TestCase   ):

    @slow
    def 					_UpperCAmelCase	(				self			:				str):







      """simple docstring"""







      for model_name in ["bert-base-uncased"]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModel.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModel.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    @slow
    def 					_UpperCAmelCase	(				self			:				int):







      """simple docstring"""







      for model_name in ["bert-base-uncased"]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForPreTraining.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForPreTraining.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    @slow
    def 					_UpperCAmelCase	(				self			:				List[Any]):







      """simple docstring"""







      for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForCausalLM.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        lowercase_					,    lowercase_								= TFAutoModelForCausalLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForCausalLM.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        lowercase_					,    lowercase_								= AutoModelForCausalLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    @slow
    def 					_UpperCAmelCase	(				self			:				List[str]):







      """simple docstring"""







      for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

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







      """simple docstring"""







      for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForMaskedLM.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        lowercase_					,    lowercase_								= TFAutoModelForMaskedLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForMaskedLM.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        lowercase_					,    lowercase_								= AutoModelForMaskedLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    @slow
    def 					_UpperCAmelCase	(				self			:				Optional[Any]):







      """simple docstring"""







      for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForSeqaSeqLM.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        lowercase_					,    lowercase_								= TFAutoModelForSeqaSeqLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForSeqaSeqLM.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        lowercase_					,    lowercase_								= AutoModelForSeqaSeqLM.from_pretrained(
            lowerCAmelCase_ ,  output_loading_info=lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

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







      """simple docstring"""







      for model_name in ["bert-base-uncased"]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForSequenceClassification.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForSequenceClassification.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    @slow
    def 					_UpperCAmelCase	(				self			:				Any):







      """simple docstring"""







      for model_name in ["bert-base-uncased"]:
        lowercase_								= AutoConfig.from_pretrained(lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= TFAutoModelForQuestionAnswering.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

        lowercase_								= AutoModelForQuestionAnswering.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
        self.assertIsNotNone(lowerCAmelCase_)
        self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)

    def 					_UpperCAmelCase	(				self			:				List[str]):







      """simple docstring"""







      lowercase_								= TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
      self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)
      self.assertEqual(model.num_parameters() ,  1_4_4_1_0)
      self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase_) ,  1_4_4_1_0)

      lowercase_								= AutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
      self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)
      self.assertEqual(model.num_parameters() ,  1_4_4_1_0)
      self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase_) ,  1_4_4_1_0)




    def 					_UpperCAmelCase	(				self			:				Union[str, Any]):







      """simple docstring"""







      lowercase_								= TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_pt=lowerCAmelCase_)
      self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)
      self.assertEqual(model.num_parameters() ,  1_4_4_1_0)
      self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase_) ,  1_4_4_1_0)

      lowercase_								= AutoModelWithLMHead.from_pretrained(lowerCAmelCase_ ,  from_tf=lowerCAmelCase_)
      self.assertIsInstance(lowerCAmelCase_ ,  lowerCAmelCase_)
      self.assertEqual(model.num_parameters() ,  1_4_4_1_0)
      self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase_) ,  1_4_4_1_0)






"""simple docstring"""
from typing import List

import datasets
from datasets.tasks import AudioClassification

from ..folder_based_builder import folder_based_builder


UpperCAmelCase						:		Union[str, Any]			= datasets.utils.logging.get_logger(__name__)


class    SCREAMING_SNAKE_CASE__ (							folder_based_builder.FolderBasedBuilderConfig   ):
    lowercase__      =   None
    lowercase__      =   None







class    SCREAMING_SNAKE_CASE__ (							folder_based_builder.FolderBasedBuilder   ):
    lowercase__      =   datasets.Audio()
    lowercase__      =   "audio"
    lowercase__      =   AudioFolderConfig
    lowercase__      =   42  # definition at the bottom of the script
    lowercase__      =   AudioClassification(audio_column="audio"      ,  label_column="label"   )







UpperCAmelCase						:		Tuple			= [
    ".aiff",
    ".au",
    ".avr",
    ".caf",
    ".flac",
    ".htk",
    ".svx",
    ".mat4",
    ".mat5",
    ".mpc2k",
    ".ogg",
    ".paf",
    ".pvf",
    ".raw",
    ".rf64",
    ".sd2",
    ".sds",
    ".ircam",
    ".voc",
    ".w64",
    ".wav",
    ".nist",
    ".wavex",
    ".wve",
    ".xi",
    ".mp3",
    ".opus",
]
UpperCAmelCase						:		Any			= AUDIO_EXTENSIONS

