


'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__snake_case    						=logging.get_logger(__name__)

__snake_case    						={
    """microsoft/resnet-50""": """https://huggingface.co/microsoft/resnet-50/blob/main/config.json""",
}

class 		UpperCAmelCase_      (  __lowercase       ,	__lowercase		):
     lowerCamelCase				:	Any		=     '''resnet'''
     lowerCamelCase				:	Optional[Any]		=     ['''basic''', '''bottleneck''']





     def __init__( self       :      Optional[int]    ,      UpperCAmelCase__       :      Tuple=3    ,      UpperCAmelCase__       :      int=6_4    ,      UpperCAmelCase__       :      List[Any]=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]    ,      UpperCAmelCase__       :      Dict=[3, 4, 6, 3]    ,      UpperCAmelCase__       :      List[Any]="bottleneck"    ,      UpperCAmelCase__       :      Dict="relu"    ,      UpperCAmelCase__       :      Any=False    ,      UpperCAmelCase__       :      int=None    ,      UpperCAmelCase__       :      Any=None    ,      **UpperCAmelCase__       :      List[str]    ,      )				->  List[str]:
        super().__init__(**UpperCAmelCase__    )
        if layer_type not in self.layer_types:
           raise ValueError(F'''layer_type={layer_type} is not one of {','.join(self.layer_types    )}'''    )
        lowerCAmelCase     =			num_channels
        lowerCAmelCase     =			embedding_size
        lowerCAmelCase     =			hidden_sizes
        lowerCAmelCase     =			depths
        lowerCAmelCase     =			layer_type
        lowerCAmelCase     =			hidden_act
        lowerCAmelCase     =			downsample_in_first_stage
        lowerCAmelCase     =			['stem'] + [F'''stage{idx}''' for idx in range(1    ,      len(UpperCAmelCase__    ) + 1    )]
        lowerCAmelCase     ,  lowerCAmelCase     =			get_aligned_output_features_output_indices(
            out_features=UpperCAmelCase__    ,      out_indices=UpperCAmelCase__    ,      stage_names=self.stage_names    )




class 		UpperCAmelCase_      (  __lowercase		):
     lowerCamelCase				:	Any		=     version.parse('''1.11'''		)





     @property
     def 							__UpperCAmelCase      ( self       :      Dict    )				->  Mapping[str, Mapping[int, str]]:
        return OrderedDict(
            [
                ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
            ]    )





     @property
     def 							__UpperCAmelCase      ( self       :      Optional[Any]    )				->  float:
        return 1E-3









'''simple docstring'''




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


__snake_case    						=logging.get_logger(__name__)

__snake_case    						={
    """facebook/s2t-wav2vec2-large-en-de""": (
        """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json"""
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}

class 		UpperCAmelCase_      (  __lowercase		):
     lowerCamelCase				:	Union[str, Any]		=     '''speech_to_text_2'''
     lowerCamelCase				:	Any		=     ['''past_key_values''']
     lowerCamelCase				:	Optional[Any]		=     {'''num_attention_heads''': '''decoder_attention_heads''', '''hidden_size''': '''d_model'''}





     def __init__( self       :      Optional[int]    ,      UpperCAmelCase__       :      Optional[Any]=1_0_0_0_0    ,      UpperCAmelCase__       :      int=6    ,      UpperCAmelCase__       :      Optional[Any]=2_0_4_8    ,      UpperCAmelCase__       :      Union[str, Any]=4    ,      UpperCAmelCase__       :      List[Any]=0.0    ,      UpperCAmelCase__       :      str=True    ,      UpperCAmelCase__       :      str="relu"    ,      UpperCAmelCase__       :      Any=2_5_6    ,      UpperCAmelCase__       :      Optional[Any]=0.1    ,      UpperCAmelCase__       :      Any=0.0    ,      UpperCAmelCase__       :      Tuple=0.0    ,      UpperCAmelCase__       :      List[Any]=0.02    ,      UpperCAmelCase__       :      List[Any]=2    ,      UpperCAmelCase__       :      str=True    ,      UpperCAmelCase__       :      List[str]=1    ,      UpperCAmelCase__       :      Any=0    ,      UpperCAmelCase__       :      Dict=2    ,      UpperCAmelCase__       :      int=1_0_2_4    ,      **UpperCAmelCase__       :      Optional[Any]    ,      )				->  Dict:
        lowerCAmelCase     =			vocab_size
        lowerCAmelCase     =			d_model
        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     =			decoder_layerdrop
        lowerCAmelCase     =			use_cache
        lowerCAmelCase     =			decoder_layers
        lowerCAmelCase     =			scale_embedding  # scale factor will be sqrt(d_model) if True
        lowerCAmelCase     =			max_target_positions

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





