


'''simple docstring'''
import math

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


__snake_case							   =  logging.get_logger(__name__)

__snake_case							   =  {
    '''facebook/data2vec-base-960h''': '''https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json''',
    # See all Data2VecAudio models at https://huggingface.co/models?filter=data2vec-audio
}
class      lowercase			(							A__      ):

		"""simple docstring"""

		_a									=       'data2vec-audio'




		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.1					,     UpperCamelCase_=0.1					,     UpperCamelCase_=0.02					,     UpperCamelCase_=1e-5					,     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_=16					,     UpperCamelCase_=19					,     UpperCamelCase_=5					,     UpperCamelCase_=0.05					,     UpperCamelCase_=10					,     UpperCamelCase_=2					,     UpperCamelCase_=0.0					,     UpperCamelCase_=10					,     UpperCamelCase_=0					,     UpperCamelCase_="sum"					,     UpperCamelCase_=False					,     UpperCamelCase_=False					,     UpperCamelCase_=256					,     UpperCamelCase_=(512, 512, 512, 512, 1500)					,     UpperCamelCase_=(5, 3, 3, 1, 1)					,     UpperCamelCase_=(1, 2, 3, 1, 1)					,     UpperCamelCase_=512					,     UpperCamelCase_=0					,     UpperCamelCase_=1					,     UpperCamelCase_=2					,     UpperCamelCase_=False					,     UpperCamelCase_=3					,     UpperCamelCase_=2					,     UpperCamelCase_=3					,     UpperCamelCase_=None					,     **UpperCamelCase_					,     ):

							'''simple docstring'''


							super().__init__(**UpperCamelCase_					,     pad_token_id=UpperCamelCase_					,     bos_token_id=UpperCamelCase_					,     eos_token_id=UpperCamelCase_							)
							UpperCamelCase__     :Optional[int]							      =				hidden_size
							UpperCamelCase__     :Dict							      =				feat_extract_activation
							UpperCamelCase__     :Any							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :int							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :Optional[int]							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :Optional[int]							      =				conv_bias
							UpperCamelCase__     :Union[str, Any]							      =				num_conv_pos_embeddings
							UpperCamelCase__     :Dict							      =				num_conv_pos_embedding_groups
							UpperCamelCase__     :str							      =				conv_pos_kernel_size
							UpperCamelCase__     :Dict							      =				len(self.conv_dim							)
							UpperCamelCase__     :int							      =				num_hidden_layers
							UpperCamelCase__     :Optional[Any]							      =				intermediate_size
							UpperCamelCase__     :List[Any]							      =				hidden_act
							UpperCamelCase__     :Any							      =				num_attention_heads
							UpperCamelCase__     :Optional[Any]							      =				hidden_dropout
							UpperCamelCase__     :int							      =				attention_dropout
							UpperCamelCase__     :Optional[int]							      =				activation_dropout
							UpperCamelCase__     :str							      =				feat_proj_dropout
							UpperCamelCase__     :Union[str, Any]							      =				final_dropout
							UpperCamelCase__     :Union[str, Any]							      =				layerdrop
							UpperCamelCase__     :Optional[Any]							      =				layer_norm_eps
							UpperCamelCase__     :Dict							      =				initializer_range
							UpperCamelCase__     :int							      =				vocab_size
							UpperCamelCase__     :str							      =				use_weighted_layer_sum

							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
							UpperCamelCase__     :List[Any]							      =				mask_time_prob
							UpperCamelCase__     :Tuple							      =				mask_time_length
							UpperCamelCase__     :Optional[Any]							      =				mask_time_min_masks
							UpperCamelCase__     :int							      =				mask_feature_prob
							UpperCamelCase__     :List[str]							      =				mask_feature_length
							UpperCamelCase__     :List[Any]							      =				mask_feature_min_masks

							# ctc loss
							UpperCamelCase__     :Union[str, Any]							      =				ctc_loss_reduction
							UpperCamelCase__     :Tuple							      =				ctc_zero_infinity

							# adapter
							UpperCamelCase__     :int							      =				add_adapter
							UpperCamelCase__     :Dict							      =				adapter_kernel_size
							UpperCamelCase__     :Union[str, Any]							      =				adapter_stride
							UpperCamelCase__     :Optional[int]							      =				num_adapter_layers
							UpperCamelCase__     :List[str]							      =				output_hidden_size or hidden_size

							# SequenceClassification-specific parameter. Feel free to ignore for other classes.
							UpperCamelCase__     :List[str]							      =				classifier_proj_size

							# XVector-specific parameters. Feel free to ignore for other classes.
							UpperCamelCase__     :Optional[Any]							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :Optional[Any]							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :Optional[int]							      =				list(UpperCamelCase_							)
							UpperCamelCase__     :Dict							      =				xvector_output_dim




		@property
		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							return math.prod(self.conv_stride							)



'''simple docstring'''
from typing import TYPE_CHECKING

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


__snake_case							   =  {'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ReformerConfig''']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							   =  ['''ReformerTokenizer''']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							   =  ['''ReformerTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							   =  [
		    '''REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''ReformerAttention''',
		    '''ReformerForMaskedLM''',
		    '''ReformerForQuestionAnswering''',
		    '''ReformerForSequenceClassification''',
		    '''ReformerLayer''',
		    '''ReformerModel''',
		    '''ReformerModelWithLMHead''',
		    '''ReformerPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer import ReformerTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer_fast import ReformerTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_reformer import (
				    REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ReformerAttention,
				    ReformerForMaskedLM,
				    ReformerForQuestionAnswering,
				    ReformerForSequenceClassification,
				    ReformerLayer,
				    ReformerModel,
				    ReformerModelWithLMHead,
				    ReformerPreTrainedModel,
				)

else:
		import sys

		__snake_case							   =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)