



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


SCREAMING_SNAKE_CASE     				=						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE     				=						{
    "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 	lowerCamelCase      (						lowercase__  ):







					'''simple docstring'''







					lowerCAmelCase_				:    List[str]									=  'yolos'



					def __init__(			self    ,	lowerCAmelCase=768    ,	lowerCAmelCase=12    ,	lowerCAmelCase=12    ,	lowerCAmelCase=3072    ,	lowerCAmelCase="gelu"    ,	lowerCAmelCase=0.0    ,	lowerCAmelCase=0.0    ,	lowerCAmelCase=0.02    ,	lowerCAmelCase=1e-1_2    ,	lowerCAmelCase=[512, 864]    ,	lowerCAmelCase=16    ,	lowerCAmelCase=3    ,	lowerCAmelCase=True    ,	lowerCAmelCase=100    ,	lowerCAmelCase=True    ,	lowerCAmelCase=False    ,	lowerCAmelCase=1    ,	lowerCAmelCase=5    ,	lowerCAmelCase=2    ,	lowerCAmelCase=5    ,	lowerCAmelCase=2    ,	lowerCAmelCase=0.1    ,	**lowerCAmelCase    ,	):
							super().__init__(**lowerCAmelCase     )

							UpperCAmelCase_						=				hidden_size
							UpperCAmelCase_						=				num_hidden_layers
							UpperCAmelCase_						=				num_attention_heads
							UpperCAmelCase_						=				intermediate_size
							UpperCAmelCase_						=				hidden_act
							UpperCAmelCase_						=				hidden_dropout_prob
							UpperCAmelCase_						=				attention_probs_dropout_prob
							UpperCAmelCase_						=				initializer_range
							UpperCAmelCase_						=				layer_norm_eps
							UpperCAmelCase_						=				image_size
							UpperCAmelCase_						=				patch_size
							UpperCAmelCase_						=				num_channels
							UpperCAmelCase_						=				qkv_bias
							UpperCAmelCase_						=				num_detection_tokens
							UpperCAmelCase_						=				use_mid_position_embeddings
							UpperCAmelCase_						=				auxiliary_loss
							# Hungarian matcher
							UpperCAmelCase_						=				class_cost
							UpperCAmelCase_						=				bbox_cost
							UpperCAmelCase_						=				giou_cost
							# Loss coefficients
							UpperCAmelCase_						=				bbox_loss_coefficient
							UpperCAmelCase_						=				giou_loss_coefficient
							UpperCAmelCase_						=				eos_coefficient





class 	lowerCamelCase      (						lowercase__  ):







					'''simple docstring'''







					lowerCAmelCase_				:    Dict									=  version.parse('1.11'  )



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



					@property
					def    A__		(			self     ):
							return 1e-4



					@property
					def    A__		(			self     ):
							return 12






from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin



class 	lowerCamelCase      (						lowercase__,     lowercase__  ):







					'''simple docstring'''







					@register_to_config
					def __init__(			self    ,	lowerCAmelCase = 768    ,	):
							super().__init__()

							UpperCAmelCase_						=				nn.Parameter(torch.zeros(1    ,	lowerCAmelCase     )     )
							UpperCAmelCase_						=				nn.Parameter(torch.ones(1    ,	lowerCAmelCase     )     )



					def    A__		(			self    ,	lowerCAmelCase = None    ,	lowerCAmelCase = None    ,	):
							UpperCAmelCase_						=				nn.Parameter(self.mean.to(lowerCAmelCase     ).to(lowerCAmelCase     )     )
							UpperCAmelCase_						=				nn.Parameter(self.std.to(lowerCAmelCase     ).to(lowerCAmelCase     )     )
							return self



					def    A__		(			self    ,	lowerCAmelCase     ):
							UpperCAmelCase_						=				(embeds - self.mean) * 1.0 / self.std
							return embeds



					def    A__		(			self    ,	lowerCAmelCase     ):
							UpperCAmelCase_						=				(embeds * self.std) + self.mean
							return embeds

