





'''simple docstring'''




from ....configuration_utils import PretrainedConfig
from ....utils import logging


__UpperCAmelCase            =       logging.get_logger(__name__)

__UpperCAmelCase            =       {
    """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json""",
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}




class      UpperCamelCase__					(					lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	'''mctct'''


					def __init__(						self				:			Tuple      ,						lowerCamelCase_				:			List[Any]=80_65      ,						lowerCamelCase_				:			Tuple=15_36      ,						lowerCamelCase_				:			Dict=36      ,						lowerCamelCase_				:			Union[str, Any]=61_44      ,						lowerCamelCase_				:			List[Any]=4      ,						lowerCamelCase_				:			Union[str, Any]=3_84      ,						lowerCamelCase_				:			str=9_20      ,						lowerCamelCase_				:			Tuple=1e-5      ,						lowerCamelCase_				:			int=0.3      ,						lowerCamelCase_				:			List[Any]="relu"      ,						lowerCamelCase_				:			Tuple=0.02      ,						lowerCamelCase_				:			Union[str, Any]=0.3      ,						lowerCamelCase_				:			List[Any]=0.3      ,						lowerCamelCase_				:			Optional[int]=1      ,						lowerCamelCase_				:			List[Any]=0      ,						lowerCamelCase_				:			str=2      ,						lowerCamelCase_				:			Tuple=1      ,						lowerCamelCase_				:			Optional[Any]=0.3      ,						lowerCamelCase_				:			Union[str, Any]=1      ,						lowerCamelCase_				:			Dict=(7,)      ,						lowerCamelCase_				:			Optional[int]=(3,)      ,						lowerCamelCase_				:			List[Any]=80      ,						lowerCamelCase_				:			Any=1      ,						lowerCamelCase_				:			Any=None      ,						lowerCamelCase_				:			Any="sum"      ,						lowerCamelCase_				:			List[str]=False      ,						**lowerCamelCase_				:			Any      ,						):

							'''simple docstring'''



							super().__init__(**lowerCamelCase_      ,						pad_token_id=lowerCamelCase_      ,						bos_token_id=lowerCamelCase_      ,						eos_token_id=lowerCamelCase_						)
							SCREAMING_SNAKE_CASE :				List[Any]		=			vocab_size
							SCREAMING_SNAKE_CASE :				Tuple		=			hidden_size
							SCREAMING_SNAKE_CASE :				List[Any]		=			num_hidden_layers
							SCREAMING_SNAKE_CASE :				int		=			intermediate_size
							SCREAMING_SNAKE_CASE :				Optional[int]		=			num_attention_heads
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			attention_head_dim
							SCREAMING_SNAKE_CASE :				Any		=			max_position_embeddings
							SCREAMING_SNAKE_CASE :				str		=			layer_norm_eps
							SCREAMING_SNAKE_CASE :				List[Any]		=			layerdrop
							SCREAMING_SNAKE_CASE :				List[str]		=			hidden_act
							SCREAMING_SNAKE_CASE :				str		=			initializer_range
							SCREAMING_SNAKE_CASE :				int		=			hidden_dropout_prob
							SCREAMING_SNAKE_CASE :				Any		=			attention_probs_dropout_prob
							SCREAMING_SNAKE_CASE :				Dict		=			pad_token_id
							SCREAMING_SNAKE_CASE :				Tuple		=			bos_token_id
							SCREAMING_SNAKE_CASE :				Tuple		=			eos_token_id
							SCREAMING_SNAKE_CASE :				Optional[int]		=			conv_glu_dim
							SCREAMING_SNAKE_CASE :				Optional[int]		=			conv_dropout
							SCREAMING_SNAKE_CASE :				int		=			num_conv_layers
							SCREAMING_SNAKE_CASE :				List[str]		=			input_feat_per_channel
							SCREAMING_SNAKE_CASE :				List[str]		=			input_channels
							SCREAMING_SNAKE_CASE :				List[Any]		=			conv_channels
							SCREAMING_SNAKE_CASE :				Optional[int]		=			ctc_loss_reduction
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			ctc_zero_infinity

							# prevents config testing fail with exporting to json
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			list(lowerCamelCase_						)
							SCREAMING_SNAKE_CASE :				Dict		=			list(lowerCamelCase_						)

							if len(self.conv_kernel						) != self.num_conv_layers:
									raise ValueError(
									    """Configuration for convolutional module is incorrect. """
									    """It is required that `len(config.conv_kernel)` == `config.num_conv_layers` """
									    f'''but is `len(config.conv_kernel) = {len(self.conv_kernel						)}`, '''
									    f'''`config.num_conv_layers = {self.num_conv_layers}`.'''						)










'''simple docstring'''




import os
import sys
import unittest


__UpperCAmelCase            =       os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, """utils"""))

import check_dummies  # noqa: E402
from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_init  # noqa: E402


# Align TRANSFORMERS_PATH in check_dummies with the current path
__UpperCAmelCase            =       os.path.join(git_repo_path, """src""", """transformers""")

__UpperCAmelCase            =       """
{0} = None
"""

__UpperCAmelCase            =       """
class {0}(metaclass=DummyObject):
    _backends = {1}

    def __init__(self, *args, **kwargs):
        requires_backends(self, {1})
"""


__UpperCAmelCase            =       """
def {0}(*args, **kwargs):
    requires_backends({0}, {1})
"""




class      UpperCamelCase__					(					unittest.TestCase			):




					"""simple docstring"""


					def lowerCamelCase_			(						self				:			List[str]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Dict		=			find_backend("""    _import_structure[\"models.albert\"].append(\"AlbertTokenizerFast\")"""						)
							self.assertIsNone(lowerCamelCase_						)

							SCREAMING_SNAKE_CASE :				str		=			find_backend("""    if not is_tokenizers_available():"""						)
							self.assertEqual(lowerCamelCase_      ,						"""tokenizers"""						)

							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			find_backend("""    if not is_tensorflow_text_available():"""						)
							self.assertEqual(lowerCamelCase_      ,						"""tensorflow_text"""						)

							SCREAMING_SNAKE_CASE :				List[str]		=			find_backend("""    if not (is_sentencepiece_available() and is_tokenizers_available()):"""						)
							self.assertEqual(lowerCamelCase_      ,						"""sentencepiece_and_tokenizers"""						)

							SCREAMING_SNAKE_CASE :				Tuple		=			find_backend(
							    """    if not (is_sentencepiece_available() and is_tensorflow_text_available()):"""						)
							self.assertEqual(lowerCamelCase_      ,						"""sentencepiece_and_tensorflow_text"""						)

							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			find_backend(
							    """    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):"""						)
							self.assertEqual(lowerCamelCase_      ,						"""sentencepiece_and_tokenizers_and_vision"""						)


					def lowerCamelCase_			(						self				:			Any						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[Any]		=			read_init()
							# We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
							self.assertIn("""torch"""      ,						lowerCamelCase_						)
							self.assertIn("""tensorflow_text"""      ,						lowerCamelCase_						)
							self.assertIn("""sentencepiece_and_tokenizers"""      ,						lowerCamelCase_						)

							# Likewise, we can't assert on the exact content of a key
							self.assertIn("""BertModel"""      ,						objects["""torch"""]						)
							self.assertIn("""TFBertModel"""      ,						objects["""tf"""]						)
							self.assertIn("""FlaxBertModel"""      ,						objects["""flax"""]						)
							self.assertIn("""BertModel"""      ,						objects["""torch"""]						)
							self.assertIn("""TFBertTokenizer"""      ,						objects["""tensorflow_text"""]						)
							self.assertIn("""convert_slow_tokenizer"""      ,						objects["""sentencepiece_and_tokenizers"""]						)


					def lowerCamelCase_			(						self				:			int						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				str		=			create_dummy_object("""CONSTANT"""      ,						"""'torch'"""						)
							self.assertEqual(lowerCamelCase_      ,						"""\nCONSTANT = None\n"""						)

							SCREAMING_SNAKE_CASE :				List[Any]		=			create_dummy_object("""function"""      ,						"""'torch'"""						)
							self.assertEqual(
							    lowerCamelCase_      ,						"""\ndef function(*args, **kwargs):\n    requires_backends(function, 'torch')\n"""						)

							SCREAMING_SNAKE_CASE :				str		=			"""
class FakeClass(metaclass=DummyObject):
    _backends = 'torch'

    def __init__(self, *args, **kwargs):
        requires_backends(self, 'torch')
"""
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			create_dummy_object("""FakeClass"""      ,						"""'torch'"""						)
							self.assertEqual(lowerCamelCase_      ,						lowerCamelCase_						)



					def lowerCamelCase_			(						self				:			int						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			"""# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends


CONSTANT = None


def function(*args, **kwargs):
    requires_backends(function, [\"torch\"])


class FakeClass(metaclass=DummyObject):
    _backends = [\"torch\"]

    def __init__(self, *args, **kwargs):
        requires_backends(self, [\"torch\"])
"""
							SCREAMING_SNAKE_CASE :				List[Any]		=			create_dummy_files({"""torch""": ["""CONSTANT""", """function""", """FakeClass"""]}						)
							self.assertEqual(dummy_files["""torch"""]      ,						lowerCamelCase_						)



