


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


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

a__       :							Any        =  {
    '''microsoft/resnet-50''': '''https://huggingface.co/microsoft/resnet-50/blob/main/config.json''',
}




class 				UpperCamelCase_			(				UpperCamelCase    ,						UpperCamelCase):

	"""simple docstring"""





	snake_case__       :						int					      =    "resnet"
	snake_case__       :						Union[str, Any]					      =    ["basic", "bottleneck"]




	def __init__(				self    :       Union[str, Any]    ,    UpperCAmelCase__    :       Optional[int]=3    ,    UpperCAmelCase__    :       int=6_4    ,    UpperCAmelCase__    :       List[Any]=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]    ,    UpperCAmelCase__    :       List[Any]=[3, 4, 6, 3]    ,    UpperCAmelCase__    :       List[Any]="bottleneck"    ,    UpperCAmelCase__    :       int="relu"    ,    UpperCAmelCase__    :       Optional[Any]=False    ,    UpperCAmelCase__    :       int=None    ,    UpperCAmelCase__    :       Any=None    ,    **UpperCAmelCase__    :       Any    ,    ) ->			Optional[int]:
						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     )}"""     )
						__SCREAMING_SNAKE_CASE		     =       num_channels
						__SCREAMING_SNAKE_CASE		     =       embedding_size
						__SCREAMING_SNAKE_CASE		     =       hidden_sizes
						__SCREAMING_SNAKE_CASE		     =       depths
						__SCREAMING_SNAKE_CASE		     =       layer_type
						__SCREAMING_SNAKE_CASE		     =       hidden_act
						__SCREAMING_SNAKE_CASE		     =       downsample_in_first_stage
						__SCREAMING_SNAKE_CASE		     =       ["stem"] + [F"""stage{idx}""" for idx in range(1    ,    len(UpperCAmelCase__     ) + 1     )]
						__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE		     =       get_aligned_output_features_output_indices(
						    out_features=UpperCAmelCase__    ,    out_indices=UpperCAmelCase__    ,    stage_names=self.stage_names     )




class 				UpperCamelCase_			(				UpperCamelCase):

	"""simple docstring"""





	snake_case__       :						Tuple					      =    version.parse("1.11")




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




	@property
	def 						UpperCAmelCase_   (				self    :       Any     ) ->			float:
						return 1E-3




"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a__       :							Optional[Any]        =  {
    '''configuration_jukebox''': [
        '''JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''JukeboxConfig''',
        '''JukeboxPriorConfig''',
        '''JukeboxVQVAEConfig''',
    ],
    '''tokenization_jukebox''': ['''JukeboxTokenizer'''],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		a__       :							int        =  [
		    '''JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''JukeboxModel''',
		    '''JukeboxPreTrainedModel''',
		    '''JukeboxVQVAE''',
		    '''JukeboxPrior''',
		]

if TYPE_CHECKING:
		from .configuration_jukebox import (
		    JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    JukeboxConfig,
		    JukeboxPriorConfig,
		    JukeboxVQVAEConfig,
		)
		from .tokenization_jukebox import JukeboxTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_jukebox import (
				    JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST,
				    JukeboxModel,
				    JukeboxPreTrainedModel,
				    JukeboxPrior,
				    JukeboxVQVAE,
				)

else:
		import sys

		a__       :							Union[str, Any]        =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
