


'''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


lowercase__     						=						logging.get_logger(__name__)

lowercase__     						=						{"""ctrl""": """https://huggingface.co/ctrl/resolve/main/config.json"""}






class lowerCAmelCase__	(     lowercase						):






			'''simple docstring'''



			lowerCamelCase__      =			"""ctrl"""
			lowerCamelCase__      =			["""past_key_values"""]
			lowerCamelCase__      =			{
			    """max_position_embeddings""": """n_positions""",
			    """hidden_size""": """n_embd""",
			    """num_attention_heads""": """n_head""",
			    """num_hidden_layers""": """n_layer""",
			}
			def __init__(  self  ,      lowercase=246534  ,      lowercase=256  ,      lowercase=1280  ,      lowercase=8192  ,      lowercase=48  ,      lowercase=16  ,      lowercase=0.1  ,      lowercase=0.1  ,      lowercase=1E-6  ,      lowercase=0.02  ,      lowercase=True  ,      **lowercase  ,      ):
							_lowerCamelCase     :			Any    =    vocab_size
							_lowerCamelCase     :			Dict    =    n_positions
							_lowerCamelCase     :			Optional[int]    =    n_embd
							_lowerCamelCase     :			str    =    n_layer
							_lowerCamelCase     :			Union[str, Any]    =    n_head
							_lowerCamelCase     :			Any    =    dff
							_lowerCamelCase     :			int    =    resid_pdrop
							_lowerCamelCase     :			Dict    =    embd_pdrop
							_lowerCamelCase     :			Union[str, Any]    =    layer_norm_epsilon
							_lowerCamelCase     :			Tuple    =    initializer_range

							_lowerCamelCase     :			str    =    use_cache

							super().__init__(**lowercase  )