

"""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_							:			int											= logging.get_logger(__name__)

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





class    lowerCamelCase						(A__			,A__			):
			lowerCamelCase__   :		Any							=							'resnet'
			lowerCamelCase__   :		List[Any]							=							['basic', 'bottleneck']

			def __init__(					self				:						Dict    ,				__UpperCAmelCase				:						Optional[Any]=3    ,				__UpperCAmelCase				:						Dict=6_4    ,				__UpperCAmelCase				:						List[str]=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]    ,				__UpperCAmelCase				:						List[str]=[3, 4, 6, 3]    ,				__UpperCAmelCase				:						Dict="bottleneck"    ,				__UpperCAmelCase				:						Any="relu"    ,				__UpperCAmelCase				:						str=False    ,				__UpperCAmelCase				:						Dict=None    ,				__UpperCAmelCase				:						Optional[Any]=None    ,				**__UpperCAmelCase				:						List[str]    ,				)   ->    Optional[Any]:
						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    lowerCamelCase						(A__			):
			lowerCamelCase__   :		Any							=							version.parse('1.11'			)

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





			@property
			def 					SCREAMING_SNAKE_CASE				(					self				:						List[Any]       )   ->    float:
						return 1e-3





"""simple docstring"""




import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline

@pytest.mark.integration
def 	A       (     ):




			'''simple docstring'''


			with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT    ):
						with pytest.raises(snake_case__    ):
									requests.request("""GET"""		,				"""https://huggingface.co"""    )
						with pytest.raises(requests.exceptions.ConnectTimeout    ):
									requests.request("""GET"""		,				"""https://huggingface.co"""		,				timeout=1.0    )

@pytest.mark.integration
def 	A       (     ):




			'''simple docstring'''


			with offline(OfflineSimulationMode.CONNECTION_FAILS    ):
						with pytest.raises(requests.exceptions.ConnectionError    ):
									requests.request("""GET"""		,				"""https://huggingface.co"""    )




def 	A       (     ):




			'''simple docstring'''


			with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1    ):
						with pytest.raises(snake_case__    ):
									http_head("""https://huggingface.co"""    )


