


"""simple docstring"""






from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...utils import logging


if TYPE_CHECKING:
	from ...feature_extraction_utils import FeatureExtractionMixin
	from ...tokenization_utils_base import PreTrainedTokenizerBase
	from ...utils import TensorType

_lowerCamelCase     =  logging.get_logger(__name__)

_lowerCamelCase     =  {
    'openai/whisper-base': 'https://huggingface.co/openai/whisper-base/resolve/main/config.json',
}

# fmt: off
_lowerCamelCase     =  [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 357, 366, 438, 532, 685,
    705, 796, 930, 1058, 1220, 1267, 1279, 1303, 1343, 1377,
    1391, 1635, 1782, 1875, 2162, 2361, 2488, 3467, 4008, 4211,
    4600, 4808, 5299, 5855, 6329, 7203, 9609, 9959, 10563, 10786,
    11420, 11709, 11907, 13163, 13697, 13700, 14808, 15306, 16410, 16791,
    17992, 19203, 19510, 20724, 22305, 22935, 27007, 30109, 30420, 33409,
    34949, 40283, 40493, 40549, 47282, 49146, 50257, 50359, 50360, 50361
]
_lowerCamelCase     =  [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 359, 503, 522, 542, 873,
    893, 902, 918, 922, 931, 1350, 1853, 1982, 2460, 2627,
    3246, 3253, 3268, 3536, 3846, 3961, 4183, 4667, 6585, 6647,
    7273, 9061, 9383, 10428, 10929, 11938, 12033, 12331, 12562, 13793,
    14157, 14635, 15265, 15618, 16553, 16604, 18362, 18956, 20075, 21675,
    22520, 26130, 26161, 26435, 28279, 29464, 31650, 32302, 32470, 36865,
    42863, 47425, 49870, 50254, 50258, 50360, 50361, 50362
]


class 			lowerCamelCase_		(			lowercase   ):





				"""simple docstring"""







				_lowerCAmelCase      :      Union[str, Any]      							=					"whisper"
				_lowerCAmelCase      :      Union[str, Any]      							=					["past_key_values"]
				_lowerCAmelCase      :      List[str]      							=					{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}



				def __init__(						self       ,		UpperCAmelCase__=5_1865       ,		UpperCAmelCase__=80       ,		UpperCAmelCase__=6       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=6       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=1536       ,		UpperCAmelCase__=1536       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=5_0257       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__="gelu"       ,		UpperCAmelCase__=256       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=0.02       ,		UpperCAmelCase__=False       ,		UpperCAmelCase__=1500       ,		UpperCAmelCase__=448       ,		UpperCAmelCase__=5_0256       ,		UpperCAmelCase__=5_0256       ,		UpperCAmelCase__=5_0256       ,		UpperCAmelCase__=None       ,		UpperCAmelCase__=[220, 5_0256]       ,		UpperCAmelCase__=False       ,		UpperCAmelCase__=256       ,		UpperCAmelCase__=False       ,		UpperCAmelCase__=0.05       ,		UpperCAmelCase__=10       ,		UpperCAmelCase__=2       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=10       ,		UpperCAmelCase__=0       ,		UpperCAmelCase__=7       ,		**UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				vocab_size
								SCREAMING_SNAKE_CASE__     							=				num_mel_bins
								SCREAMING_SNAKE_CASE__     							=				d_model
								SCREAMING_SNAKE_CASE__     							=				encoder_layers
								SCREAMING_SNAKE_CASE__     							=				encoder_attention_heads
								SCREAMING_SNAKE_CASE__     							=				decoder_layers
								SCREAMING_SNAKE_CASE__     							=				decoder_attention_heads
								SCREAMING_SNAKE_CASE__     							=				decoder_ffn_dim
								SCREAMING_SNAKE_CASE__     							=				encoder_ffn_dim
								SCREAMING_SNAKE_CASE__     							=				dropout
								SCREAMING_SNAKE_CASE__     							=				attention_dropout
								SCREAMING_SNAKE_CASE__     							=				activation_dropout
								SCREAMING_SNAKE_CASE__     							=				activation_function
								SCREAMING_SNAKE_CASE__     							=				init_std
								SCREAMING_SNAKE_CASE__     							=				encoder_layerdrop
								SCREAMING_SNAKE_CASE__     							=				decoder_layerdrop
								SCREAMING_SNAKE_CASE__     							=				use_cache
								SCREAMING_SNAKE_CASE__     							=				encoder_layers
								SCREAMING_SNAKE_CASE__     							=				scale_embedding  # scale factor will be sqrt(d_model) if True
								SCREAMING_SNAKE_CASE__     							=				max_source_positions
								SCREAMING_SNAKE_CASE__     							=				max_target_positions

								# Audio Classification-specific parameters. Feel free to ignore for other classes.
								SCREAMING_SNAKE_CASE__     							=				classifier_proj_size
								SCREAMING_SNAKE_CASE__     							=				use_weighted_layer_sum

								# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
								SCREAMING_SNAKE_CASE__     							=				apply_spec_augment
								SCREAMING_SNAKE_CASE__     							=				mask_time_prob
								SCREAMING_SNAKE_CASE__     							=				mask_time_length
								SCREAMING_SNAKE_CASE__     							=				mask_time_min_masks
								SCREAMING_SNAKE_CASE__     							=				mask_feature_prob
								SCREAMING_SNAKE_CASE__     							=				mask_feature_length
								SCREAMING_SNAKE_CASE__     							=				mask_feature_min_masks

								SCREAMING_SNAKE_CASE__     							=				median_filter_width

								super().__init__(
								    pad_token_id=UpperCAmelCase__       ,		bos_token_id=UpperCAmelCase__       ,		eos_token_id=UpperCAmelCase__       ,		is_encoder_decoder=UpperCAmelCase__       ,		decoder_start_token_id=UpperCAmelCase__       ,		suppress_tokens=UpperCAmelCase__       ,		begin_suppress_tokens=UpperCAmelCase__       ,		**UpperCAmelCase__       ,		)


class 			lowerCamelCase_		(			lowercase   ):





				"""simple docstring"""







				@property
				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				OrderedDict(
								    [
								        ("input_features", {0: "batch", 1: "feature_size", 2: "encoder_sequence"}),
								    ]     )
								if self.use_past:
												SCREAMING_SNAKE_CASE__     							=				{0: "batch"}
								else:
												SCREAMING_SNAKE_CASE__     							=				{0: "batch", 1: "decoder_sequence"}

								if self.use_past:
												self.fill_with_past_key_values_(UpperCAmelCase__       ,		direction="inputs"     )

								return common_inputs



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__ = -1       ,		UpperCAmelCase__ = -1       ,		UpperCAmelCase__ = False       ,		UpperCAmelCase__ = None       ,		UpperCAmelCase__ = 2_2050       ,		UpperCAmelCase__ = 5.0       ,		UpperCAmelCase__ = 220       ,		):
								SCREAMING_SNAKE_CASE__     							=				OrderedDict()
								SCREAMING_SNAKE_CASE__     							=				OnnxConfig.generate_dummy_inputs(
								    self       ,		preprocessor=preprocessor.feature_extractor       ,		batch_size=UpperCAmelCase__       ,		framework=UpperCAmelCase__       ,		sampling_rate=UpperCAmelCase__       ,		time_duration=UpperCAmelCase__       ,		frequency=UpperCAmelCase__       ,		)
								SCREAMING_SNAKE_CASE__     							=				encoder_inputs["input_features"].shape[2]
								SCREAMING_SNAKE_CASE__     							=				encoder_sequence_length // 2 if self.use_past else seq_length

								SCREAMING_SNAKE_CASE__     							=				super().generate_dummy_inputs(
								    preprocessor.tokenizer       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				encoder_inputs.pop("input_features"     )
								SCREAMING_SNAKE_CASE__     							=				decoder_inputs.pop("decoder_input_ids"     )

								if "past_key_values" in decoder_inputs:
												SCREAMING_SNAKE_CASE__     							=				decoder_inputs.pop("past_key_values"     )

								return dummy_inputs






				@property
				def   lowerCAmelCase__		(						self     ):
								return 1e-3




"""simple docstring"""






from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCamelCase     =  {
    'configuration_autoformer': [
        'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'AutoformerConfig',
    ],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowerCamelCase     =  [
	    'AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'AutoformerForPrediction',
	    'AutoformerModel',
	    'AutoformerPreTrainedModel',
	]


if TYPE_CHECKING:
	from .configuration_autoformer import (
	    AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    AutoformerConfig,
	)

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_autoformer import (
		    AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    AutoformerForPrediction,
		    AutoformerModel,
		    AutoformerPreTrainedModel,
		)

else:
	import sys

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