





'''simple docstring'''






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


A__    :       Union[str, Any]              =logging.get_logger(__name__)

A__    :       str              ={
    '''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 			UpperCAmelCase					(      snake_case_       ):
      _lowercase:      Any											=       '''speech_to_text'''
      _lowercase:      Optional[Any]											=       ['''past_key_values''']
      _lowercase:      List[str]											=       {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}




      def __init__(      self      :			int      ,      __snake_case      :			List[str]=1_00_00      ,      __snake_case      :			Any=12      ,      __snake_case      :			str=20_48      ,      __snake_case      :			int=4      ,      __snake_case      :			Union[str, Any]=6      ,      __snake_case      :			Optional[Any]=20_48      ,      __snake_case      :			Tuple=4      ,      __snake_case      :			str=0.0      ,      __snake_case      :			str=0.0      ,      __snake_case      :			Any=True      ,      __snake_case      :			Tuple=True      ,      __snake_case      :			int="relu"      ,      __snake_case      :			Tuple=2_56      ,      __snake_case      :			Union[str, Any]=0.1      ,      __snake_case      :			Tuple=0.0      ,      __snake_case      :			Dict=0.0      ,      __snake_case      :			List[Any]=0.02      ,      __snake_case      :			int=2      ,      __snake_case      :			int=True      ,      __snake_case      :			Tuple=1      ,      __snake_case      :			Union[str, Any]=0      ,      __snake_case      :			List[Any]=2      ,      __snake_case      :			Any=60_00      ,      __snake_case      :			List[str]=10_24      ,      __snake_case      :			Optional[Any]=2      ,      __snake_case      :			Optional[Any]=(5, 5)      ,      __snake_case      :			int=10_24      ,      __snake_case      :			int=80      ,      __snake_case      :			str=1      ,      **__snake_case      :			Any      ,      )    ->				Dict:
            _lowerCAmelCase												=							vocab_size
            _lowerCAmelCase												=							d_model
            _lowerCAmelCase												=							encoder_ffn_dim
            _lowerCAmelCase												=							encoder_layers
            _lowerCAmelCase												=							encoder_attention_heads
            _lowerCAmelCase												=							decoder_ffn_dim
            _lowerCAmelCase												=							decoder_layers
            _lowerCAmelCase												=							decoder_attention_heads
            _lowerCAmelCase												=							dropout
            _lowerCAmelCase												=							attention_dropout
            _lowerCAmelCase												=							activation_dropout
            _lowerCAmelCase												=							activation_function
            _lowerCAmelCase												=							init_std
            _lowerCAmelCase												=							encoder_layerdrop
            _lowerCAmelCase												=							decoder_layerdrop
            _lowerCAmelCase												=							use_cache
            _lowerCAmelCase												=							encoder_layers
            _lowerCAmelCase												=							scale_embedding  # scale factor will be sqrt(d_model) if True
            _lowerCAmelCase												=							max_source_positions
            _lowerCAmelCase												=							max_target_positions
            _lowerCAmelCase												=							num_conv_layers
            _lowerCAmelCase												=							list(__snake_case  )
            _lowerCAmelCase												=							conv_channels
            _lowerCAmelCase												=							input_feat_per_channel
            _lowerCAmelCase												=							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=__snake_case      ,      bos_token_id=__snake_case      ,      eos_token_id=__snake_case      ,      is_encoder_decoder=__snake_case      ,      decoder_start_token_id=__snake_case      ,      **__snake_case      ,      )













'''simple docstring'''






# Author: OMKAR PATHAK, Nwachukwu Chidiebere

# Use a Python dictionary to construct the graph.
from __future__ import annotations

from pprint import pformat
from typing import Generic, TypeVar

A__    :       List[str]              =TypeVar('''T''')




class 			UpperCAmelCase					(      Generic[T]       ):




      def __init__(      self      :			Tuple      ,      __snake_case      :			bool = True  )    ->				None:
            _lowerCAmelCase												=							{}  # dictionary of lists
            _lowerCAmelCase												=							directed




      def     lowercase__   (      self      :			Union[str, Any]      ,      __snake_case      :			T      ,      __snake_case      :			T  )    ->				GraphAdjacencyList[T]:

            if not self.directed:  # For undirected graphs
                  # if both source vertex and destination vertex are both present in the
                  # adjacency list, add destination vertex to source vertex list of adjacent
                  # vertices and add source vertex to destination vertex list of adjacent
                  # vertices.
                  if source_vertex in self.adj_list and destination_vertex in self.adj_list:
                        self.adj_list[source_vertex].append(__snake_case  )
                        self.adj_list[destination_vertex].append(__snake_case  )
                  # if only source vertex is present in adjacency list, add destination vertex
                  # to source vertex list of adjacent vertices, then create a new vertex with
                  # destination vertex as key and assign a list containing the source vertex
                  # as it's first adjacent vertex.
                  elif source_vertex in self.adj_list:
                        self.adj_list[source_vertex].append(__snake_case  )
                        _lowerCAmelCase												=							[source_vertex]
                  # if only destination vertex is present in adjacency list, add source vertex
                  # to destination vertex list of adjacent vertices, then create a new vertex
                  # with source vertex as key and assign a list containing the source vertex
                  # as it's first adjacent vertex.
                  elif destination_vertex in self.adj_list:
                        self.adj_list[destination_vertex].append(__snake_case  )
                        _lowerCAmelCase												=							[destination_vertex]
                  # if both source vertex and destination vertex are not present in adjacency
                  # list, create a new vertex with source vertex as key and assign a list
                  # containing the destination vertex as it's first adjacent vertex also
                  # create a new vertex with destination vertex as key and assign a list
                  # containing the source vertex as it's first adjacent vertex.
                  else:
                        _lowerCAmelCase												=							[destination_vertex]
                        _lowerCAmelCase												=							[source_vertex]
            else:  # For directed graphs
                  # if both source vertex and destination vertex are present in adjacency
                  # list, add destination vertex to source vertex list of adjacent vertices.
                  if source_vertex in self.adj_list and destination_vertex in self.adj_list:
                        self.adj_list[source_vertex].append(__snake_case  )
                  # if only source vertex is present in adjacency list, add destination
                  # vertex to source vertex list of adjacent vertices and create a new vertex
                  # with destination vertex as key, which has no adjacent vertex
                  elif source_vertex in self.adj_list:
                        self.adj_list[source_vertex].append(__snake_case  )
                        _lowerCAmelCase												=							[]
                  # if only destination vertex is present in adjacency list, create a new
                  # vertex with source vertex as key and assign a list containing destination
                  # vertex as first adjacent vertex
                  elif destination_vertex in self.adj_list:
                        _lowerCAmelCase												=							[destination_vertex]
                  # if both source vertex and destination vertex are not present in adjacency
                  # list, create a new vertex with source vertex as key and a list containing
                  # destination vertex as it's first adjacent vertex. Then create a new vertex
                  # with destination vertex as key, which has no adjacent vertex
                  else:
                        _lowerCAmelCase												=							[destination_vertex]
                        _lowerCAmelCase												=							[]

            return self




      def __repr__(      self      :			int  )    ->				str:
            return pformat(self.adj_list  )






