



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


lowerCAmelCase__					  =  logging.get_logger(__name__)

lowerCAmelCase__					  =  {
    '''facebook/s2t-small-librispeech-asr''': (
        '''https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json'''
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech_to_text
}

class 				snake_case__(_UpperCamelCase      ):

					"""simple docstring"""






					lowercase_								=		"""speech_to_text"""
					lowercase_								=		["""past_key_values"""]
					lowercase_								=		{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}







					def __init__(							self :     int				,       SCREAMING_SNAKE_CASE :     List[Any]=10_000				,       SCREAMING_SNAKE_CASE :     Optional[Any]=12				,       SCREAMING_SNAKE_CASE :     Optional[int]=2_048				,       SCREAMING_SNAKE_CASE :     Optional[Any]=4				,       SCREAMING_SNAKE_CASE :     Optional[int]=6				,       SCREAMING_SNAKE_CASE :     Dict=2_048				,       SCREAMING_SNAKE_CASE :     Dict=4				,       SCREAMING_SNAKE_CASE :     Union[str, Any]=0.0				,       SCREAMING_SNAKE_CASE :     int=0.0				,       SCREAMING_SNAKE_CASE :     Optional[Any]=True				,       SCREAMING_SNAKE_CASE :     Any=True				,       SCREAMING_SNAKE_CASE :     str="relu"				,       SCREAMING_SNAKE_CASE :     int=256				,       SCREAMING_SNAKE_CASE :     List[Any]=0.1				,       SCREAMING_SNAKE_CASE :     str=0.0				,       SCREAMING_SNAKE_CASE :     str=0.0				,       SCREAMING_SNAKE_CASE :     List[Any]=0.02				,       SCREAMING_SNAKE_CASE :     Any=2				,       SCREAMING_SNAKE_CASE :     Optional[Any]=True				,       SCREAMING_SNAKE_CASE :     str=1				,       SCREAMING_SNAKE_CASE :     Optional[Any]=0				,       SCREAMING_SNAKE_CASE :     str=2				,       SCREAMING_SNAKE_CASE :     Tuple=6_000				,       SCREAMING_SNAKE_CASE :     List[str]=1_024				,       SCREAMING_SNAKE_CASE :     Tuple=2				,       SCREAMING_SNAKE_CASE :     int=(5, 5)				,       SCREAMING_SNAKE_CASE :     List[Any]=1_024				,       SCREAMING_SNAKE_CASE :     int=80				,       SCREAMING_SNAKE_CASE :     str=1				,       **SCREAMING_SNAKE_CASE :     List[str]				,       ):
									lowercase__					:   Tuple													=					vocab_size
									lowercase__					:   Tuple													=					d_model
									lowercase__					:   List[str]													=					encoder_ffn_dim
									lowercase__					:   List[str]													=					encoder_layers
									lowercase__					:   int													=					encoder_attention_heads
									lowercase__					:   Optional[Any]													=					decoder_ffn_dim
									lowercase__					:   List[Any]													=					decoder_layers
									lowercase__					:   int													=					decoder_attention_heads
									lowercase__					:   Any													=					dropout
									lowercase__					:   Optional[int]													=					attention_dropout
									lowercase__					:   List[str]													=					activation_dropout
									lowercase__					:   str													=					activation_function
									lowercase__					:   Union[str, Any]													=					init_std
									lowercase__					:   str													=					encoder_layerdrop
									lowercase__					:   Union[str, Any]													=					decoder_layerdrop
									lowercase__					:   Optional[int]													=					use_cache
									lowercase__					:   Any													=					encoder_layers
									lowercase__					:   Dict													=					scale_embedding  # scale factor will be sqrt(d_model) if True
									lowercase__					:   Tuple													=					max_source_positions
									lowercase__					:   Dict													=					max_target_positions
									lowercase__					:   Tuple													=					num_conv_layers
									lowercase__					:   int													=					list(SCREAMING_SNAKE_CASE					)
									lowercase__					:   Optional[Any]													=					conv_channels
									lowercase__					:   Any													=					input_feat_per_channel
									lowercase__					:   List[Any]													=					input_channels

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

									super().__init__(
									    pad_token_id=SCREAMING_SNAKE_CASE				,       bos_token_id=SCREAMING_SNAKE_CASE				,       eos_token_id=SCREAMING_SNAKE_CASE				,       is_encoder_decoder=SCREAMING_SNAKE_CASE				,       decoder_start_token_id=SCREAMING_SNAKE_CASE				,       **SCREAMING_SNAKE_CASE				,       )









from typing import TYPE_CHECKING

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


lowerCAmelCase__					  =  {}

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

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


if TYPE_CHECKING:
				try:
								if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_nllb import NllbTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_nllb_fast import NllbTokenizerFast

else:
				import sys

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




