


'''simple docstring'''

import copy
import os
import tempfile
from unittest import TestCase
from unittest.mock import patch

import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import pytest

from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
from datasets.features import ArrayaD, ClassLabel, Features, Image, Value
from datasets.features.features import ArrayaDExtensionType, cast_to_python_objects
from datasets.keyhash import DuplicatedKeysError, InvalidKeyError

from .utils import require_pil





class   snake_case					(					UpperCAmelCase_    ):





		"""simple docstring"""




		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence([1, 2, 3]  )  )
			self.assertEqual(arr.type    ,						pa.intaa()  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			with self.assertRaises(_lowercase  ):
				lowerCamelCase_  				=						pa.array(TypedSequence([1, 2, 3]  )    ,						type=pa.intaa()  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			with self.assertRaises(_lowercase  ):
				lowerCamelCase_  				=						pa.array(TypedSequence([1, 2, 3]    ,						try_type=Value("bool"  )    ,						type=Value("int64"  )  )  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence([1, 2, 3]    ,						type=Value("int32"  )  )  )
			self.assertEqual(arr.type    ,						pa.intaa()  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			with self.assertRaises((TypeError, pa.lib.ArrowInvalid)  ):
				lowerCamelCase_  				=						pa.array(TypedSequence(["foo", "bar"]    ,						type=Value("int64"  )  )  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence([1, 2, 3]    ,						try_type=Value("int32"  )  )  )
			self.assertEqual(arr.type    ,						pa.intaa()  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence(["foo", "bar"]    ,						try_type=Value("int64"  )  )  )
			self.assertEqual(arr.type    ,						pa.string()  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence([[[1, 2, 3]]]    ,						type=ArrayaD((1, 3)    ,						"int64"  )  )  )
			self.assertEqual(arr.type    ,						ArrayaDExtensionType((1, 3)    ,						"int64"  )  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			with self.assertRaises((TypeError, pa.lib.ArrowInvalid)  ):
				lowerCamelCase_  				=						pa.array(TypedSequence(["foo", "bar"]    ,						type=ArrayaD((1, 3)    ,						"int64"  )  )  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence([[[1, 2, 3]]]    ,						try_type=ArrayaD((1, 3)    ,						"int64"  )  )  )
			self.assertEqual(arr.type    ,						ArrayaDExtensionType((1, 3)    ,						"int64"  )  )






		def 						snake_case	(					self  ):







			"""simple docstring"""
			lowerCamelCase_  				=						pa.array(TypedSequence(["foo", "bar"]    ,						try_type=ArrayaD((1, 3)    ,						"int64"  )  )  )
			self.assertEqual(arr.type    ,						pa.string()  )







		@require_pil
		def 						snake_case	(					self  ):







			"""simple docstring"""
			import PIL.Image

			lowerCamelCase_  				=						PIL.Image.fromarray(np.arange(10    ,						dtype=np.uinta  ).reshape(2    ,						5  )  )
			with patch(
			    "datasets.arrow_writer.cast_to_python_objects"    ,						side_effect=_lowercase  ) as mock_cast_to_python_objects:
				lowerCamelCase_  				=						pa.array(TypedSequence([{"path": None, "bytes": b"image_bytes"}, pil_image]    ,						type=Image()  )  )
				lowerCamelCase_  				=						mock_cast_to_python_objects.call_args_list[-1]
				self.assertIn("optimize_list_casting"    ,						_lowercase  )
				self.assertFalse(kwargs["optimize_list_casting"]  )





def __snake_case      (   UpperCAmelCase_		:		List[Any]      ,       UpperCAmelCase_		:		int	):
	lowerCamelCase_  				=						pa.BufferReader(UpperCAmelCase_	) if isinstance(UpperCAmelCase_      ,       pa.Buffer	) else pa.memory_map(UpperCAmelCase_	)
	lowerCamelCase_  				=						pa.ipc.open_stream(UpperCAmelCase_	)
	lowerCamelCase_  				=						f.read_all()
	assert len(pa_table.to_batches()	) == expected_num_chunks
	assert pa_table.to_pydict() == {"col_1": ["foo", "bar"], "col_2": [1, 2]}
	del pa_table





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 1, 10]	)
@pytest.mark.parametrize(
    "fields"      ,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]	)
def __snake_case      (   UpperCAmelCase_		:		str      ,       UpperCAmelCase_		:		int	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	lowerCamelCase_  				=						pa.schema(UpperCAmelCase_	) if fields else None
	with ArrowWriter(stream=UpperCAmelCase_      ,       schema=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_	) as writer:
		writer.write({"col_1": "foo", "col_2": 1}	)
		writer.write({"col_1": "bar", "col_2": 2}	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	if not fields:
		lowerCamelCase_  				=						{'col_1': pa.string(), 'col_2': pa.intaa()}
	assert writer._schema == pa.schema(UpperCAmelCase_      ,       metadata=writer._schema.metadata	)
	_check_output(output.getvalue()      ,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1	)





def __snake_case      (   ):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	lowerCamelCase_  				=						Features({"labels": ClassLabel(names=["neg", "pos"]	)}	)
	with ArrowWriter(stream=UpperCAmelCase_      ,       features=UpperCAmelCase_	) as writer:
		writer.write({"labels": 0}	)
		writer.write({"labels": 1}	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	assert writer._schema == features.arrow_schema
	assert writer._schema.metadata == features.arrow_schema.metadata
	lowerCamelCase_  				=						pa.BufferReader(output.getvalue()	)
	lowerCamelCase_  				=						pa.ipc.open_stream(UpperCAmelCase_	)
	lowerCamelCase_  				=						f.read_all()
	lowerCamelCase_  				=						pa_table.schema
	assert pa_table.num_rows == 2
	assert schema == features.arrow_schema
	assert schema.metadata == features.arrow_schema.metadata
	assert features == Features.from_arrow_schema(UpperCAmelCase_	)





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 1, 10]	)
def __snake_case      (   UpperCAmelCase_		:		int	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ArrowWriter(
	    stream=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_      ,       hash_salt="split_name"      ,       check_duplicates=UpperCAmelCase_      ,       ) as writer:
		with pytest.raises(UpperCAmelCase_	):
			writer.write({"col_1": "foo", "col_2": 1}      ,       key=[1, 2]	)
			lowerCamelCase_  				=						writer.finalize()





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 2, 10]	)
def __snake_case      (   UpperCAmelCase_		:		Tuple	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ArrowWriter(
	    stream=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_      ,       hash_salt="split_name"      ,       check_duplicates=UpperCAmelCase_      ,       ) as writer:
		with pytest.raises(UpperCAmelCase_	):
			writer.write({"col_1": "foo", "col_2": 1}      ,       key=10	)
			writer.write({"col_1": "bar", "col_2": 2}      ,       key=10	)
			lowerCamelCase_  				=						writer.finalize()





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 2, 10]	)
def __snake_case      (   UpperCAmelCase_		:		Union[str, Any]	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ArrowWriter(
	    stream=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_      ,       hash_salt="split_name"      ,       check_duplicates=UpperCAmelCase_      ,       ) as writer:
		writer.write({"col_1": "foo", "col_2": 1}      ,       key=1	)
		writer.write({"col_1": "bar", "col_2": 2}      ,       key=2	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	_check_output(output.getvalue()      ,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1	)





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 1, 10]	)
@pytest.mark.parametrize(
    "fields"      ,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]	)
def __snake_case      (   UpperCAmelCase_		:		Optional[Any]      ,       UpperCAmelCase_		:		Optional[Any]	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	lowerCamelCase_  				=						pa.schema(UpperCAmelCase_	) if fields else None
	with ArrowWriter(stream=UpperCAmelCase_      ,       schema=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_	) as writer:
		writer.write_batch({"col_1": ["foo", "bar"], "col_2": [1, 2]}	)
		writer.write_batch({"col_1": [], "col_2": []}	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	if not fields:
		lowerCamelCase_  				=						{'col_1': pa.string(), 'col_2': pa.intaa()}
	assert writer._schema == pa.schema(UpperCAmelCase_      ,       metadata=writer._schema.metadata	)
	_check_output(output.getvalue()      ,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1	)





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 1, 10]	)
@pytest.mark.parametrize(
    "fields"      ,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]	)
def __snake_case      (   UpperCAmelCase_		:		Dict      ,       UpperCAmelCase_		:		str	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	lowerCamelCase_  				=						pa.schema(UpperCAmelCase_	) if fields else None
	with ArrowWriter(stream=UpperCAmelCase_      ,       schema=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_	) as writer:
		writer.write_table(pa.Table.from_pydict({"col_1": ["foo", "bar"], "col_2": [1, 2]}	)	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	if not fields:
		lowerCamelCase_  				=						{'col_1': pa.string(), 'col_2': pa.intaa()}
	assert writer._schema == pa.schema(UpperCAmelCase_      ,       metadata=writer._schema.metadata	)
	_check_output(output.getvalue()      ,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1	)





@pytest.mark.parametrize("writer_batch_size"      ,       [None, 1, 10]	)
@pytest.mark.parametrize(
    "fields"      ,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]	)
def __snake_case      (   UpperCAmelCase_		:		List[Any]      ,       UpperCAmelCase_		:		int	):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	lowerCamelCase_  				=						pa.schema(UpperCAmelCase_	) if fields else None
	with ArrowWriter(stream=UpperCAmelCase_      ,       schema=UpperCAmelCase_      ,       writer_batch_size=UpperCAmelCase_	) as writer:
		writer.write_row(pa.Table.from_pydict({"col_1": ["foo"], "col_2": [1]}	)	)
		writer.write_row(pa.Table.from_pydict({"col_1": ["bar"], "col_2": [2]}	)	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	if not fields:
		lowerCamelCase_  				=						{'col_1': pa.string(), 'col_2': pa.intaa()}
	assert writer._schema == pa.schema(UpperCAmelCase_      ,       metadata=writer._schema.metadata	)
	_check_output(output.getvalue()      ,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1	)





def __snake_case      (   ):
	with tempfile.TemporaryDirectory() as tmp_dir:
		lowerCamelCase_  				=						{'col_1': pa.string(), 'col_2': pa.intaa()}
		lowerCamelCase_  				=						os.path.join(UpperCAmelCase_      ,       "test.arrow"	)
		with ArrowWriter(path=UpperCAmelCase_      ,       schema=pa.schema(UpperCAmelCase_	)	) as writer:
			writer.write_batch({"col_1": ["foo", "bar"], "col_2": [1, 2]}	)
			lowerCamelCase_  				=						writer.finalize()
		assert num_examples == 2
		assert num_bytes > 0
		assert writer._schema == pa.schema(UpperCAmelCase_      ,       metadata=writer._schema.metadata	)
		_check_output(UpperCAmelCase_      ,       1	)





def __snake_case      (   UpperCAmelCase_		:		Optional[int]	):
	if pa.types.is_list(UpperCAmelCase_	):
		return get_base_dtype(arr_type.value_type	)
	else:
		return arr_type





def __snake_case      (   UpperCAmelCase_		:		List[str]      ,       UpperCAmelCase_		:		str	):
	if isinstance(lst[0]      ,       UpperCAmelCase_	):
		change_first_primitive_element_in_list(lst[0]      ,       UpperCAmelCase_	)
	else:
		lowerCamelCase_  				=						value





@pytest.mark.parametrize("optimized_int_type, expected_dtype"      ,       [(None, pa.intaa()), (Value("int32"	), pa.intaa())]	)
@pytest.mark.parametrize("sequence"      ,       [[1, 2, 3], [[1, 2, 3]], [[[1, 2, 3]]]]	)
def __snake_case      (   UpperCAmelCase_		:		Dict      ,       UpperCAmelCase_		:		Tuple      ,       UpperCAmelCase_		:		Dict	):
	lowerCamelCase_  				=						pa.array(TypedSequence(UpperCAmelCase_      ,       optimized_int_type=UpperCAmelCase_	)	)
	assert get_base_dtype(arr.type	) == expected_dtype





@pytest.mark.parametrize(
    "col, expected_dtype"      ,       [
        ("attention_mask", pa.inta()),
        ("special_tokens_mask", pa.inta()),
        ("token_type_ids", pa.inta()),
        ("input_ids", pa.intaa()),
        ("other", pa.intaa()),
    ]      ,       )
@pytest.mark.parametrize("sequence"      ,       [[1, 2, 3], [[1, 2, 3]], [[[1, 2, 3]]]]	)
def __snake_case      (   UpperCAmelCase_		:		Optional[Any]      ,       UpperCAmelCase_		:		List[Any]      ,       UpperCAmelCase_		:		List[Any]	):
	lowerCamelCase_  				=						pa.array(OptimizedTypedSequence(UpperCAmelCase_      ,       col=UpperCAmelCase_	)	)
	assert get_base_dtype(arr.type	) == expected_dtype

	# not in range
	if col != "other":
		# avoids errors due to in-place modifications
		lowerCamelCase_  				=						copy.deepcopy(UpperCAmelCase_	)
		lowerCamelCase_  				=						np.iinfo(expected_dtype.to_pandas_dtype()	).max + 1
		change_first_primitive_element_in_list(UpperCAmelCase_      ,       UpperCAmelCase_	)
		lowerCamelCase_  				=						pa.array(OptimizedTypedSequence(UpperCAmelCase_      ,       col=UpperCAmelCase_	)	)
		assert get_base_dtype(arr.type	) == pa.intaa()





@pytest.mark.parametrize("raise_exception"      ,       [False, True]	)
def __snake_case      (   UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		Optional[int]	):
	lowerCamelCase_  				=						str(tmp_path / "dataset-train.arrow"	)
	try:
		with ArrowWriter(path=UpperCAmelCase_	) as writer:
			if raise_exception:
				raise pa.lib.ArrowInvalid()
			else:
				writer.stream.close()
	except pa.lib.ArrowInvalid:
		pass
	finally:
		assert writer.stream.closed





def __snake_case      (   UpperCAmelCase_		:		Dict	):
	lowerCamelCase_  				=						'mock://dataset-train.arrow'
	with ArrowWriter(path=UpperCAmelCase_      ,       storage_options=mockfs.storage_options	) as writer:
		assert isinstance(writer._fs      ,       type(UpperCAmelCase_	)	)
		assert writer._fs.storage_options == mockfs.storage_options
		writer.write({"col_1": "foo", "col_2": 1}	)
		writer.write({"col_1": "bar", "col_2": 2}	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	assert mockfs.exists(UpperCAmelCase_	)





def __snake_case      (   ):
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ParquetWriter(stream=UpperCAmelCase_	) as writer:
		writer.write({"col_1": "foo", "col_2": 1}	)
		writer.write({"col_1": "bar", "col_2": 2}	)
		lowerCamelCase_  				=						writer.finalize()
	assert num_examples == 2
	assert num_bytes > 0
	lowerCamelCase_  				=						pa.BufferReader(output.getvalue()	)
	lowerCamelCase_  				=						pq.read_table(UpperCAmelCase_	)
	assert pa_table.to_pydict() == {"col_1": ["foo", "bar"], "col_2": [1, 2]}





@require_pil
@pytest.mark.parametrize("embed_local_files"      ,       [False, True]	)
def __snake_case      (   UpperCAmelCase_		:		Optional[int]      ,       UpperCAmelCase_		:		Optional[Any]	):
	import PIL.Image

	lowerCamelCase_  				=						str(tmp_path / "test_image_rgb.jpg"	)
	PIL.Image.fromarray(np.zeros((5, 5)      ,       dtype=np.uinta	)	).save(UpperCAmelCase_      ,       format="png"	)
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ParquetWriter(
	    stream=UpperCAmelCase_      ,       features=Features({"image": Image()}	)      ,       embed_local_files=UpperCAmelCase_	) as writer:
		writer.write({"image": image_path}	)
		writer.finalize()
	lowerCamelCase_  				=						pa.BufferReader(output.getvalue()	)
	lowerCamelCase_  				=						pq.read_table(UpperCAmelCase_	)
	lowerCamelCase_  				=						pa_table.to_pydict()
	if embed_local_files:
		assert isinstance(out["image"][0]["path"]      ,       UpperCAmelCase_	)
		with open(UpperCAmelCase_      ,       "rb"	) as f:
			assert out["image"][0]["bytes"] == f.read()
	else:
		assert out["image"][0]["path"] == image_path
		assert out["image"][0]["bytes"] is None







def __snake_case      (   ):
	lowerCamelCase_  				=						pa.schema([pa.field("col_1"      ,       pa.string()      ,       nullable=UpperCAmelCase_	)]	)
	lowerCamelCase_  				=						pa.BufferOutputStream()
	with ArrowWriter(stream=UpperCAmelCase_	) as writer:
		writer._build_writer(inferred_schema=UpperCAmelCase_	)
		assert writer._schema == pa.schema([pa.field("col_1"      ,       pa.string()	)]	)







'''simple docstring'''

import functools
import operator

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


a_						:       List[str]      			=				logging.get_logger(__name__)

a_						:       Dict      			=				{
    """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					(					lowercase    ):





  """simple docstring"""




  _lowerCamelCase						=						"unispeech"






  def __init__(					self    ,						UpperCamelCase=32    ,						UpperCamelCase=768    ,						UpperCamelCase=12    ,						UpperCamelCase=12    ,						UpperCamelCase=3072    ,						UpperCamelCase="gelu"    ,						UpperCamelCase=0.1    ,						UpperCamelCase=0.1    ,						UpperCamelCase=0.1    ,						UpperCamelCase=0.0    ,						UpperCamelCase=0.0    ,						UpperCamelCase=0.1    ,						UpperCamelCase=0.1    ,						UpperCamelCase=0.02    ,						UpperCamelCase=1e-5    ,						UpperCamelCase="group"    ,						UpperCamelCase="gelu"    ,						UpperCamelCase=(512, 512, 512, 512, 512, 512, 512)    ,						UpperCamelCase=(5, 2, 2, 2, 2, 2, 2)    ,						UpperCamelCase=(10, 3, 3, 3, 3, 2, 2)    ,						UpperCamelCase=False    ,						UpperCamelCase=128    ,						UpperCamelCase=16    ,						UpperCamelCase=False    ,						UpperCamelCase=True    ,						UpperCamelCase=0.05    ,						UpperCamelCase=10    ,						UpperCamelCase=2    ,						UpperCamelCase=0.0    ,						UpperCamelCase=10    ,						UpperCamelCase=0    ,						UpperCamelCase=320    ,						UpperCamelCase=2    ,						UpperCamelCase=0.1    ,						UpperCamelCase=100    ,						UpperCamelCase=256    ,						UpperCamelCase=256    ,						UpperCamelCase=0.1    ,						UpperCamelCase="mean"    ,						UpperCamelCase=False    ,						UpperCamelCase=False    ,						UpperCamelCase=256    ,						UpperCamelCase=80    ,						UpperCamelCase=0    ,						UpperCamelCase=1    ,						UpperCamelCase=2    ,						UpperCamelCase=0.5    ,						**UpperCamelCase    ,						):







   """simple docstring"""
   super().__init__(**UpperCamelCase    ,						pad_token_id=UpperCamelCase    ,						bos_token_id=UpperCamelCase    ,						eos_token_id=UpperCamelCase  )
   lowerCamelCase_  				=						hidden_size
   lowerCamelCase_  				=						feat_extract_norm
   lowerCamelCase_  				=						feat_extract_activation
   lowerCamelCase_  				=						list(UpperCamelCase  )
   lowerCamelCase_  				=						list(UpperCamelCase  )
   lowerCamelCase_  				=						list(UpperCamelCase  )
   lowerCamelCase_  				=						conv_bias
   lowerCamelCase_  				=						num_conv_pos_embeddings
   lowerCamelCase_  				=						num_conv_pos_embedding_groups
   lowerCamelCase_  				=						len(self.conv_dim  )
   lowerCamelCase_  				=						num_hidden_layers
   lowerCamelCase_  				=						intermediate_size
   lowerCamelCase_  				=						hidden_act
   lowerCamelCase_  				=						num_attention_heads
   lowerCamelCase_  				=						hidden_dropout
   lowerCamelCase_  				=						attention_dropout
   lowerCamelCase_  				=						activation_dropout
   lowerCamelCase_  				=						feat_proj_dropout
   lowerCamelCase_  				=						final_dropout
   lowerCamelCase_  				=						layerdrop
   lowerCamelCase_  				=						layer_norm_eps
   lowerCamelCase_  				=						initializer_range
   lowerCamelCase_  				=						num_ctc_classes
   lowerCamelCase_  				=						vocab_size
   lowerCamelCase_  				=						do_stable_layer_norm
   lowerCamelCase_  				=						use_weighted_layer_sum
   lowerCamelCase_  				=						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
   lowerCamelCase_  				=						apply_spec_augment
   lowerCamelCase_  				=						mask_time_prob
   lowerCamelCase_  				=						mask_time_length
   lowerCamelCase_  				=						mask_time_min_masks
   lowerCamelCase_  				=						mask_feature_prob
   lowerCamelCase_  				=						mask_feature_length
   lowerCamelCase_  				=						mask_feature_min_masks

   # parameters for pretraining with codevector quantized representations
   lowerCamelCase_  				=						num_codevectors_per_group
   lowerCamelCase_  				=						num_codevector_groups
   lowerCamelCase_  				=						contrastive_logits_temperature
   lowerCamelCase_  				=						feat_quantizer_dropout
   lowerCamelCase_  				=						num_negatives
   lowerCamelCase_  				=						codevector_dim
   lowerCamelCase_  				=						proj_codevector_dim
   lowerCamelCase_  				=						diversity_loss_weight

   # ctc loss
   lowerCamelCase_  				=						ctc_loss_reduction
   lowerCamelCase_  				=						ctc_zero_infinity

   # pretraining loss
   lowerCamelCase_  				=						replace_prob







  @property
  def 						snake_case	(					self  ):







   """simple docstring"""
   return functools.reduce(operator.mul    ,						self.conv_stride    ,						1  )



