






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


A__	:    Optional[Any]			 = logging.get_logger(__name__)

A__	:    Dict			 = {
    'hustvl/yolos-small': 'https://huggingface.co/hustvl/yolos-small/resolve/main/config.json',
    # See all YOLOS models at https://huggingface.co/models?filter=yolos
}







class        lowercase__      (							snake_case__       ):
			_UpperCAmelCase		:Tuple             =			"yolos"


			def __init__(				self					:  Optional[int]       ,	snake_case__					:  Dict=768       ,	snake_case__					:  str=12       ,	snake_case__					:  Any=12       ,	snake_case__					:  List[Any]=3072       ,	snake_case__					:  int="gelu"       ,	snake_case__					:  Optional[int]=0.0       ,	snake_case__					:  List[str]=0.0       ,	snake_case__					:  List[Any]=0.02       ,	snake_case__					:  Optional[Any]=1E-12       ,	snake_case__					:  Any=[512, 864]       ,	snake_case__					:  Tuple=16       ,	snake_case__					:  Optional[int]=3       ,	snake_case__					:  Union[str, Any]=True       ,	snake_case__					:  Any=100       ,	snake_case__					:  Union[str, Any]=True       ,	snake_case__					:  str=False       ,	snake_case__					:  Union[str, Any]=1       ,	snake_case__					:  Union[str, Any]=5       ,	snake_case__					:  List[str]=2       ,	snake_case__					:  Optional[Any]=5       ,	snake_case__					:  str=2       ,	snake_case__					:  int=0.1       ,	**snake_case__					:  Optional[Any]       ,	):
										super().__init__(**snake_case__ )

										lowerCamelCase_	:							int									=hidden_size
										lowerCamelCase_	:							Any									=num_hidden_layers
										lowerCamelCase_	:							int									=num_attention_heads
										lowerCamelCase_	:							Dict									=intermediate_size
										lowerCamelCase_	:							Any									=hidden_act
										lowerCamelCase_	:							Tuple									=hidden_dropout_prob
										lowerCamelCase_	:							str									=attention_probs_dropout_prob
										lowerCamelCase_	:							Any									=initializer_range
										lowerCamelCase_	:							Any									=layer_norm_eps
										lowerCamelCase_	:							str									=image_size
										lowerCamelCase_	:							List[Any]									=patch_size
										lowerCamelCase_	:							List[Any]									=num_channels
										lowerCamelCase_	:							List[Any]									=qkv_bias
										lowerCamelCase_	:							Union[str, Any]									=num_detection_tokens
										lowerCamelCase_	:							str									=use_mid_position_embeddings
										lowerCamelCase_	:							Dict									=auxiliary_loss
										# Hungarian matcher
										lowerCamelCase_	:							List[str]									=class_cost
										lowerCamelCase_	:							Tuple									=bbox_cost
										lowerCamelCase_	:							List[Any]									=giou_cost
										# Loss coefficients
										lowerCamelCase_	:							Optional[Any]									=bbox_loss_coefficient
										lowerCamelCase_	:							int									=giou_loss_coefficient
										lowerCamelCase_	:							Optional[Any]									=eos_coefficient







class        lowercase__      (							snake_case__       ):
			_UpperCAmelCase		:Union[str, Any]             =			version.parse("1.11"       )


			@property
			def      UpperCAmelCase__						(				self					:  List[str] ):
										return OrderedDict(
										    [
										        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
										    ] )


			@property
			def      UpperCAmelCase__						(				self					:  Optional[Any] ):
										return 1E-4


			@property
			def      UpperCAmelCase__						(				self					:  List[str] ):
										return 12











"""simple docstring"""



import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows

def 			_snake_case    (					lowerCamelCase__     :   Any  )    ->     Union[str, Any]:  # picklable for multiprocessing
							return i + 1

@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 			_snake_case    (					)    ->     List[Any]:
							with parallel_backend("spark"  ):
														assert ParallelBackendConfig.backend_name == "spark"

							lowerCamelCase_	:							Optional[Any]									=[1, 2, 3]
							with pytest.raises(lowerCamelCase__  ):
														with parallel_backend("unsupported backend"  ):
																					map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=2  )

							with pytest.raises(lowerCamelCase__  ):
														with parallel_backend("unsupported backend"  ):
																					map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=-1  )

@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize("num_proc"    ,						[2, -1]  )
def 			_snake_case    (					lowerCamelCase__     :   Tuple  )    ->     Optional[Any]:
							lowerCamelCase_	:							str									=[1, 2]
							lowerCamelCase_	:							List[str]									={"a": 1, "b": 2}
							lowerCamelCase_	:							List[str]									={"a": [1, 2], "b": [3, 4]}
							lowerCamelCase_	:							Optional[int]									={"a": {"1": 1}, "b": 2}
							lowerCamelCase_	:							int									={"a": 1, "b": 2, "c": 3, "d": 4}
							lowerCamelCase_	:							Optional[int]									=[2, 3]
							lowerCamelCase_	:							List[Any]									={"a": 2, "b": 3}
							lowerCamelCase_	:							int									={"a": [2, 3], "b": [4, 5]}
							lowerCamelCase_	:							str									={"a": {"1": 2}, "b": 3}
							lowerCamelCase_	:							Dict									={"a": 2, "b": 3, "c": 4, "d": 5}

							with parallel_backend("spark"  ):
														assert map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=lowerCamelCase__  ) == expected_map_nested_sa
														assert map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=lowerCamelCase__  ) == expected_map_nested_sa
														assert map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=lowerCamelCase__  ) == expected_map_nested_sa
														assert map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=lowerCamelCase__  ) == expected_map_nested_sa
														assert map_nested(lowerCamelCase__    ,						lowerCamelCase__    ,						num_proc=lowerCamelCase__  ) == expected_map_nested_sa



