



'''simple docstring'''



import itertools
import random
import unittest

import numpy as np

from transformers import BatchFeature, SpeechTaFeatureExtractor
from transformers.testing_utils import require_torch
from transformers.utils.import_utils import is_torch_available

from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin


if is_torch_available():
		import torch


lowerCamelCase									=							random.Random()



def 	_A							( _lowerCAmelCase	, _lowerCAmelCase=1.0	, _lowerCAmelCase=None	, _lowerCAmelCase=None       ):



							"""simple docstring"""



							if rng is None:
														__lowercase													=global_rng

							__lowercase													=[]
							for batch_idx in range(shape[0]       ):
														values.append([]       )
														for _ in range(shape[1]       ):
																					values[-1].append(rng.random() * scale       )

							return values





@require_torch
class _UpperCamelCase		(  unittest.TestCase		):





				'''simple docstring'''





				def __init__(				self	:	Tuple	,							_lowerCAmelCase	:	List[Any]	,							_lowerCAmelCase	:	Dict=7	,							_lowerCAmelCase	:	List[Any]=4_0_0	,							_lowerCAmelCase	:	Optional[int]=2_0_0_0	,							_lowerCAmelCase	:	List[Any]=1	,							_lowerCAmelCase	:	str=0.0	,							_lowerCAmelCase	:	Optional[Any]=1_6_0_0_0	,							_lowerCAmelCase	:	str=True	,							_lowerCAmelCase	:	List[str]=8_0	,							_lowerCAmelCase	:	Dict=1_6	,							_lowerCAmelCase	:	Tuple=6_4	,							_lowerCAmelCase	:	Any="hann_window"	,							_lowerCAmelCase	:	Dict=8_0	,							_lowerCAmelCase	:	Optional[int]=7_6_0_0	,							_lowerCAmelCase	:	str=1e-10	,							_lowerCAmelCase	:	Union[str, Any]=True	,							):







											'''simple docstring'''

											__lowercase													=parent
											__lowercase													=batch_size
											__lowercase													=min_seq_length
											__lowercase													=max_seq_length
											__lowercase													=(self.max_seq_length - self.min_seq_length) // (self.batch_size - 1)
											__lowercase													=feature_size
											__lowercase													=padding_value
											__lowercase													=sampling_rate
											__lowercase													=do_normalize
											__lowercase													=num_mel_bins
											__lowercase													=hop_length
											__lowercase													=win_length
											__lowercase													=win_function
											__lowercase													=fmin
											__lowercase													=fmax
											__lowercase													=mel_floor
											__lowercase													=return_attention_mask

				def 					__lowerCamelCase  (				self	:	Tuple):







											'''simple docstring'''

											return {
											    "feature_size": self.feature_size,
											    "padding_value": self.padding_value,
											    "sampling_rate": self.sampling_rate,
											    "do_normalize": self.do_normalize,
											    "num_mel_bins": self.num_mel_bins,
											    "hop_length": self.hop_length,
											    "win_length": self.win_length,
											    "win_function": self.win_function,
											    "fmin": self.fmin,
											    "fmax": self.fmax,
											    "mel_floor": self.mel_floor,
											    "return_attention_mask": self.return_attention_mask,
											}

				def 					__lowerCamelCase  (				self	:	List[str]	,							_lowerCAmelCase	:	str=False	,							_lowerCAmelCase	:	List[Any]=False):







											'''simple docstring'''

											def _flatten(_lowerCAmelCase	:	Optional[Any]):
																		return list(itertools.chain(*_lowerCamelCase))

											if equal_length:
																		__lowercase													=floats_list((self.batch_size, self.max_seq_length))
											else:
																		# make sure that inputs increase in size
																		__lowercase													=[
																		    _flatten(floats_list((x, self.feature_size)))
																		    for x in range(self.min_seq_length	,							self.max_seq_length	,							self.seq_length_diff)
																		]

											if numpify:
																		__lowercase													=[np.asarray(_lowerCamelCase) for x in speech_inputs]

											return speech_inputs

				def 					__lowerCamelCase  (				self	:	int	,							_lowerCAmelCase	:	Optional[int]=False	,							_lowerCAmelCase	:	Optional[int]=False):







											'''simple docstring'''

											if equal_length:
																		__lowercase													=[floats_list((self.max_seq_length, self.num_mel_bins)) for _ in range(self.batch_size)]
											else:
																		# make sure that inputs increase in size
																		__lowercase													=[
																		    floats_list((x, self.num_mel_bins))
																		    for x in range(self.min_seq_length	,							self.max_seq_length	,							self.seq_length_diff)
																		]

											if numpify:
																		__lowercase													=[np.asarray(_lowerCamelCase) for x in speech_inputs]

											return speech_inputs





@require_torch
class _UpperCamelCase		(  _snake_case   ,							unittest.TestCase		):





				'''simple docstring'''





				lowerCAmelCase__            =     SpeechTaFeatureExtractor

				def 					__lowerCamelCase  (				self	:	List[Any]):







											'''simple docstring'''

											__lowercase													=SpeechTaFeatureExtractionTester(self)

				def 					__lowerCamelCase  (				self	:	Any	,							_lowerCAmelCase	:	Tuple):







											'''simple docstring'''

											self.assertTrue(np.all(np.mean(_lowerCamelCase	,							axis=0) < 1e-3))
											self.assertTrue(np.all(np.abs(np.var(_lowerCamelCase	,							axis=0) - 1) < 1e-3))

				def 					__lowerCamelCase  (				self	:	int):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											# create three inputs of length 800, 1000, and 1200
											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]
											__lowercase													=[np.asarray(_lowerCamelCase) for speech_input in speech_inputs]

											# Test not batched input
											__lowercase													=feat_extract(speech_inputs[0]	,							return_tensors='np').input_values
											__lowercase													=feat_extract(np_speech_inputs[0]	,							return_tensors='np').input_values
											self.assertTrue(np.allclose(_lowerCamelCase	,							_lowerCamelCase	,							atol=1e-3))

											# Test batched
											__lowercase													=feat_extract(_lowerCamelCase	,							return_tensors='np').input_values
											__lowercase													=feat_extract(_lowerCamelCase	,							return_tensors='np').input_values
											for enc_seq_a, enc_seq_a in zip(_lowerCamelCase	,							_lowerCamelCase):
																		self.assertTrue(np.allclose(_lowerCamelCase	,							_lowerCamelCase	,							atol=1e-3))

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







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]

											__lowercase													=['''longest''', '''max_length''', '''do_not_pad''']
											__lowercase													=[None, 1_6_0_0, None]
											for max_length, padding in zip(_lowerCamelCase	,							_lowerCamelCase):
																		__lowercase													=feat_extract(_lowerCamelCase	,							padding=_lowerCamelCase	,							max_length=_lowerCamelCase	,							return_tensors='np')
																		__lowercase													=processed.input_values

																		self._check_zero_mean_unit_variance(input_values[0][:8_0_0])
																		self.assertTrue(input_values[0][8_0_0:].sum() < 1e-6)
																		self._check_zero_mean_unit_variance(input_values[1][:1_0_0_0])
																		self.assertTrue(input_values[0][1_0_0_0:].sum() < 1e-6)
																		self._check_zero_mean_unit_variance(input_values[2][:1_2_0_0])

				def 					__lowerCamelCase  (				self	:	Tuple):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											__lowercase													=range(8_0_0	,							1_4_0_0	,							2_0_0)
											__lowercase													=[floats_list((1, x))[0] for x in lengths]

											__lowercase													=['''longest''', '''max_length''', '''do_not_pad''']
											__lowercase													=[None, 1_6_0_0, None]

											for max_length, padding in zip(_lowerCamelCase	,							_lowerCamelCase):
																		__lowercase													=feat_extract(_lowerCamelCase	,							max_length=_lowerCamelCase	,							padding=_lowerCamelCase)
																		__lowercase													=processed.input_values

																		self._check_zero_mean_unit_variance(input_values[0][:8_0_0])
																		self._check_zero_mean_unit_variance(input_values[1][:1_0_0_0])
																		self._check_zero_mean_unit_variance(input_values[2][:1_2_0_0])

				def 					__lowerCamelCase  (				self	:	str):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]
											__lowercase													=feat_extract(
											    _lowerCamelCase	,							truncation=_lowerCamelCase	,							max_length=1_0_0_0	,							padding='max_length'	,							return_tensors='np')
											__lowercase													=processed.input_values

											self._check_zero_mean_unit_variance(input_values[0, :8_0_0])
											self._check_zero_mean_unit_variance(input_values[1])
											self._check_zero_mean_unit_variance(input_values[2])

				def 					__lowerCamelCase  (				self	:	Dict):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]
											__lowercase													=feat_extract(
											    _lowerCamelCase	,							truncation=_lowerCamelCase	,							max_length=1_0_0_0	,							padding='longest'	,							return_tensors='np')
											__lowercase													=processed.input_values

											self._check_zero_mean_unit_variance(input_values[0, :8_0_0])
											self._check_zero_mean_unit_variance(input_values[1, :1_0_0_0])
											self._check_zero_mean_unit_variance(input_values[2])

											# make sure that if max_length < longest -> then pad to max_length
											self.assertTrue(input_values.shape == (3, 1_0_0_0))

											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]
											__lowercase													=feat_extract(
											    _lowerCamelCase	,							truncation=_lowerCamelCase	,							max_length=2_0_0_0	,							padding='longest'	,							return_tensors='np')
											__lowercase													=processed.input_values

											self._check_zero_mean_unit_variance(input_values[0, :8_0_0])
											self._check_zero_mean_unit_variance(input_values[1, :1_0_0_0])
											self._check_zero_mean_unit_variance(input_values[2])

											# make sure that if max_length > longest -> then pad to longest
											self.assertTrue(input_values.shape == (3, 1_2_0_0))

				def 					__lowerCamelCase  (				self	:	List[Any]):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											__lowercase													=np.random.rand(1_0_0).astype(np.floataa)
											__lowercase													=np_speech_inputs.tolist()

											for inputs in [py_speech_inputs, np_speech_inputs]:
																		__lowercase													=feature_extractor.pad([{'input_values': inputs}]	,							return_tensors='np')
																		self.assertTrue(np_processed.input_values.dtype == np.floataa)
																		__lowercase													=feature_extractor.pad([{'input_values': inputs}]	,							return_tensors='pt')
																		self.assertTrue(pt_processed.input_values.dtype == torch.floataa)

				def 					__lowerCamelCase  (				self	:	List[Any]):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
											# create three inputs of length 800, 1000, and 1200
											__lowercase													=[floats_list((1, x))[0] for x in range(8_0_0	,							1_4_0_0	,							2_0_0)]
											__lowercase													=[np.asarray(_lowerCamelCase) for speech_input in speech_inputs]

											# Test feature size
											__lowercase													=feature_extractor(audio_target=_lowerCamelCase	,							padding=_lowerCamelCase	,							return_tensors='np').input_values
											self.assertTrue(input_values.ndim == 3)
											self.assertTrue(input_values.shape[-1] == feature_extractor.num_mel_bins)

											# Test not batched input
											__lowercase													=feature_extractor(speech_inputs[0]	,							return_tensors='np').input_values
											__lowercase													=feature_extractor(np_speech_inputs[0]	,							return_tensors='np').input_values
											self.assertTrue(np.allclose(_lowerCamelCase	,							_lowerCamelCase	,							atol=1e-3))

											# Test batched
											__lowercase													=feature_extractor(_lowerCamelCase	,							return_tensors='np').input_values
											__lowercase													=feature_extractor(_lowerCamelCase	,							return_tensors='np').input_values
											for enc_seq_a, enc_seq_a in zip(_lowerCamelCase	,							_lowerCamelCase):
																		self.assertTrue(np.allclose(_lowerCamelCase	,							_lowerCamelCase	,							atol=1e-3))

											# Test 2-D numpy arrays are batched.
											__lowercase													=[floats_list((1, x))[0] for x in (8_0_0, 8_0_0, 8_0_0)]
											__lowercase													=np.asarray(_lowerCamelCase)
											__lowercase													=feature_extractor(_lowerCamelCase	,							return_tensors='np').input_values
											__lowercase													=feature_extractor(_lowerCamelCase	,							return_tensors='np').input_values
											for enc_seq_a, enc_seq_a in zip(_lowerCamelCase	,							_lowerCamelCase):
																		self.assertTrue(np.allclose(_lowerCamelCase	,							_lowerCamelCase	,							atol=1e-3))

				def 					__lowerCamelCase  (				self	:	List[str]):







											'''simple docstring'''

											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target()
											__lowercase													=self.feature_extraction_class(**self.feat_extract_dict)
											__lowercase													=feat_extract.model_input_names[0]

											__lowercase													=BatchFeature({input_name: speech_inputs})

											self.assertTrue(all(len(_lowerCamelCase) == len(_lowerCamelCase) for x, y in zip(_lowerCamelCase	,							processed_features[input_name])))

											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target(equal_length=_lowerCamelCase)
											__lowercase													=BatchFeature({input_name: speech_inputs}	,							tensor_type='np')

											__lowercase													=processed_features[input_name]

											if len(batch_features_input.shape) < 3:
																		__lowercase													=batch_features_input[:, :, None]

											self.assertTrue(
											    batch_features_input.shape
											    == (self.feat_extract_tester.batch_size, len(speech_inputs[0]), self.feat_extract_tester.num_mel_bins))

				@require_torch
				def 					__lowerCamelCase  (				self	:	Optional[Any]):







											'''simple docstring'''

											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target(equal_length=_lowerCamelCase)
											__lowercase													=self.feature_extraction_class(**self.feat_extract_dict)
											__lowercase													=feat_extract.model_input_names[0]

											__lowercase													=BatchFeature({input_name: speech_inputs}	,							tensor_type='pt')

											__lowercase													=processed_features[input_name]

											if len(batch_features_input.shape) < 3:
																		__lowercase													=batch_features_input[:, :, None]

											self.assertTrue(
											    batch_features_input.shape
											    == (self.feat_extract_tester.batch_size, len(speech_inputs[0]), self.feat_extract_tester.num_mel_bins))

				@require_torch
				def 					__lowerCamelCase  (				self	:	Optional[int]):







											'''simple docstring'''

											__lowercase													=self.feature_extraction_class(**self.feat_extract_dict)
											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target()
											__lowercase													=feat_extract.model_input_names[0]

											__lowercase													=BatchFeature({input_name: speech_inputs})

											__lowercase													=feat_extract.num_mel_bins  # hack!

											__lowercase													=feat_extract.pad(_lowerCamelCase	,							padding='longest'	,							return_tensors='np')[input_name]
											__lowercase													=feat_extract.pad(_lowerCamelCase	,							padding='longest'	,							return_tensors='pt')[input_name]

											self.assertTrue(abs(input_np.astype(np.floataa).sum() - input_pt.numpy().astype(np.floataa).sum()) < 1e-2)

				def 					__lowerCamelCase  (				self	:	int):







											'''simple docstring'''

											__lowercase													=self.feat_extract_dict
											__lowercase													=True
											__lowercase													=self.feature_extraction_class(**_lowerCamelCase)
											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target()
											__lowercase													=[len(_lowerCamelCase) for x in speech_inputs]
											__lowercase													=feat_extract.model_input_names[0]

											__lowercase													=BatchFeature({input_name: speech_inputs})

											__lowercase													=feat_extract.num_mel_bins  # hack!

											__lowercase													=feat_extract.pad(_lowerCamelCase	,							padding='longest'	,							return_tensors='np')
											self.assertIn('attention_mask'	,							_lowerCamelCase)
											self.assertListEqual(list(processed.attention_mask.shape)	,							list(processed[input_name].shape[:2]))
											self.assertListEqual(processed.attention_mask.sum(-1).tolist()	,							_lowerCamelCase)

				def 					__lowerCamelCase  (				self	:	Tuple):







											'''simple docstring'''

											__lowercase													=self.feat_extract_dict
											__lowercase													=True
											__lowercase													=self.feature_extraction_class(**_lowerCamelCase)
											__lowercase													=self.feat_extract_tester.prepare_inputs_for_target()
											__lowercase													=[len(_lowerCamelCase) for x in speech_inputs]
											__lowercase													=feat_extract.model_input_names[0]

											__lowercase													=BatchFeature({input_name: speech_inputs})
											__lowercase													=min(_lowerCamelCase)

											__lowercase													=feat_extract.num_mel_bins  # hack!

											__lowercase													=feat_extract.pad(
											    _lowerCamelCase	,							padding='max_length'	,							max_length=_lowerCamelCase	,							truncation=_lowerCamelCase	,							return_tensors='np')
											self.assertIn('attention_mask'	,							_lowerCamelCase)
											self.assertListEqual(
											    list(processed_pad.attention_mask.shape)	,							[processed_pad[input_name].shape[0], max_length])
											self.assertListEqual(
											    processed_pad.attention_mask[:, :max_length].sum(-1).tolist()	,							[max_length for x in speech_inputs])

				def 					__lowerCamelCase  (				self	:	List[Any]	,							_lowerCAmelCase	:	List[str]):







											'''simple docstring'''

											from datasets import load_dataset

											__lowercase													=load_dataset('hf-internal-testing/librispeech_asr_dummy'	,							'clean'	,							split='validation')
											# automatic decoding with librispeech
											__lowercase													=ds.sort('id').select(range(_lowerCamelCase))[:num_samples]['''audio''']

											return [x["array"] for x in speech_samples]

				def 					__lowerCamelCase  (				self	:	List[Any]):







											'''simple docstring'''

											__lowercase													=torch.tensor(
											    [2.38_04e-03, 2.07_52e-03, 1.98_36e-03, 2.10_57e-03, 1.61_74e-03,
											     3.05_18e-04, 9.15_53e-05, 3.35_69e-04, 9.76_56e-04, 1.83_11e-03,
											     2.01_42e-03, 2.10_57e-03, 1.73_95e-03, 4.57_76e-04, -3.96_73e-04,
											     4.57_76e-04, 1.00_71e-03, 9.15_53e-05, 4.88_28e-04, 1.15_97e-03,
											     7.32_42e-04, 9.46_04e-04, 1.80_05e-03, 1.83_11e-03, 8.85_01e-04,
											     4.27_25e-04, 4.88_28e-04, 7.32_42e-04, 1.09_86e-03, 2.10_57e-03])
											# fmt: on

											__lowercase													=self._load_datasamples(1)
											__lowercase													=SpeechTaFeatureExtractor()
											__lowercase													=feature_extractor(_lowerCamelCase	,							return_tensors='pt').input_values
											self.assertEquals(input_values.shape	,							(1, 9_3_6_8_0))
											self.assertTrue(torch.allclose(input_values[0, :3_0]	,							_lowerCamelCase	,							atol=1e-6))

				def 					__lowerCamelCase  (				self	:	int):







											'''simple docstring'''

											__lowercase													=torch.tensor(
											    [-2.6870, -3.0104, -3.1356, -3.5352, -3.0044, -3.0353, -3.4719, -3.6777,
											     -3.1520, -2.9435, -2.6553, -2.8795, -2.9944, -2.5921, -3.0279, -3.0386,
											     -3.0864, -3.1291, -3.2353, -2.7444, -2.6831, -2.7287, -3.1761, -3.1571,
											     -3.2726, -3.0582, -3.1007, -3.4533, -3.4695, -3.0998])
											# fmt: on

											__lowercase													=self._load_datasamples(1)
											__lowercase													=SpeechTaFeatureExtractor()
											__lowercase													=feature_extractor(audio_target=_lowerCamelCase	,							return_tensors='pt').input_values
											self.assertEquals(input_values.shape	,							(1, 3_6_6, 8_0))
											self.assertTrue(torch.allclose(input_values[0, 0, :3_0]	,							_lowerCamelCase	,							atol=1e-4))







import functools
import operator

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


snake_case							:       Optional[int]										=	logging.get_logger(__name__)

snake_case							:       Optional[int]										=	{
    '''microsoft/unispeech-large-1500h-cv''': (
        '''https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'''
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}







class 						_snake_case    ( _snake_case				):
 SCREAMING_SNAKE_CASE__ =			'unispeech'




 def __init__(						self   ,    _lowerCamelCase=32   ,    _lowerCamelCase=768   ,    _lowerCamelCase=12   ,    _lowerCamelCase=12   ,    _lowerCamelCase=3072   ,    _lowerCamelCase="gelu"   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=0.02   ,    _lowerCamelCase=1e-5   ,    _lowerCamelCase="group"   ,    _lowerCamelCase="gelu"   ,    _lowerCamelCase=(512, 512, 512, 512, 512, 512, 512)   ,    _lowerCamelCase=(5, 2, 2, 2, 2, 2, 2)   ,    _lowerCamelCase=(10, 3, 3, 3, 3, 2, 2)   ,    _lowerCamelCase=False   ,    _lowerCamelCase=128   ,    _lowerCamelCase=16   ,    _lowerCamelCase=False   ,    _lowerCamelCase=True   ,    _lowerCamelCase=0.05   ,    _lowerCamelCase=10   ,    _lowerCamelCase=2   ,    _lowerCamelCase=0.0   ,    _lowerCamelCase=10   ,    _lowerCamelCase=0   ,    _lowerCamelCase=320   ,    _lowerCamelCase=2   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase=100   ,    _lowerCamelCase=256   ,    _lowerCamelCase=256   ,    _lowerCamelCase=0.1   ,    _lowerCamelCase="mean"   ,    _lowerCamelCase=False   ,    _lowerCamelCase=False   ,    _lowerCamelCase=256   ,    _lowerCamelCase=80   ,    _lowerCamelCase=0   ,    _lowerCamelCase=1   ,    _lowerCamelCase=2   ,    _lowerCamelCase=0.5   ,    **_lowerCamelCase   ,    ):
       super().__init__(**_lowerCamelCase   ,    pad_token_id=_lowerCamelCase   ,    bos_token_id=_lowerCamelCase   ,    eos_token_id=_lowerCamelCase       )
       a		:Any									=			hidden_size
       a		:str									=			feat_extract_norm
       a		:List[Any]									=			feat_extract_activation
       a		:Tuple									=			list(_lowerCamelCase       )
       a		:Any									=			list(_lowerCamelCase       )
       a		:List[Any]									=			list(_lowerCamelCase       )
       a		:Union[str, Any]									=			conv_bias
       a		:str									=			num_conv_pos_embeddings
       a		:str									=			num_conv_pos_embedding_groups
       a		:Tuple									=			len(self.conv_dim       )
       a		:int									=			num_hidden_layers
       a		:Any									=			intermediate_size
       a		:Optional[Any]									=			hidden_act
       a		:Tuple									=			num_attention_heads
       a		:Any									=			hidden_dropout
       a		:Any									=			attention_dropout
       a		:Optional[Any]									=			activation_dropout
       a		:Optional[Any]									=			feat_proj_dropout
       a		:Any									=			final_dropout
       a		:int									=			layerdrop
       a		:int									=			layer_norm_eps
       a		:Dict									=			initializer_range
       a		:Dict									=			num_ctc_classes
       a		:Optional[Any]									=			vocab_size
       a		:str									=			do_stable_layer_norm
       a		:Tuple									=			use_weighted_layer_sum
       a		:Any									=			classifier_proj_size

       if (
           (len(self.conv_stride       ) != self.num_feat_extract_layers)
           or (len(self.conv_kernel       ) != self.num_feat_extract_layers)
           or (len(self.conv_dim       ) != self.num_feat_extract_layers)
       ):
             raise ValueError(
                 '''Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='''
                 ''' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='''
                 F''' {len(self.conv_dim       )}`, `len(config.conv_stride) = {len(self.conv_stride       )}`,'''
                 F''' `len(config.conv_kernel) = {len(self.conv_kernel       )}`.'''       )

       # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
       a		:List[Any]									=			apply_spec_augment
       a		:Any									=			mask_time_prob
       a		:Union[str, Any]									=			mask_time_length
       a		:str									=			mask_time_min_masks
       a		:Tuple									=			mask_feature_prob
       a		:Dict									=			mask_feature_length
       a		:int									=			mask_feature_min_masks

       # parameters for pretraining with codevector quantized representations
       a		:Union[str, Any]									=			num_codevectors_per_group
       a		:Dict									=			num_codevector_groups
       a		:List[Any]									=			contrastive_logits_temperature
       a		:Union[str, Any]									=			feat_quantizer_dropout
       a		:Optional[Any]									=			num_negatives
       a		:Tuple									=			codevector_dim
       a		:Optional[Any]									=			proj_codevector_dim
       a		:Union[str, Any]									=			diversity_loss_weight

       # ctc loss
       a		:List[Any]									=			ctc_loss_reduction
       a		:Union[str, Any]									=			ctc_zero_infinity

       # pretraining loss
       a		:int									=			replace_prob




 @property
 def 			SCREAMING_SNAKE_CASE__							(						self       ):
       return functools.reduce(operator.mul   ,    self.conv_stride   ,    1       )





