
'''simple docstring'''







from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__lowerCAmelCase   =       logging.get_logger(__name__)

__lowerCAmelCase   =       {
    """shi-labs/nat-mini-in1k-224""": """https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json""",
    # See all Nat models at https://huggingface.co/models?filter=nat
}







class UpperCAmelCase__      (					UpperCamelCase__       ,							UpperCamelCase__      ):





  """simple docstring"""

  __UpperCAmelCase							:							str    					=   '''nat'''

  __UpperCAmelCase							:							List[str]    					=   {
      '''num_attention_heads''': '''num_heads''',
      '''num_hidden_layers''': '''num_layers''',
  }


  def __init__(						self :	List[Any]				,_a :	Union[str, Any]=4				,_a :	Dict=3				,_a :	str=64				,_a :	Optional[int]=[3, 4, 6, 5]				,_a :	Tuple=[2, 4, 8, 16]				,_a :	List[str]=7				,_a :	Optional[Any]=3.0				,_a :	Tuple=True				,_a :	Tuple=0.0				,_a :	Dict=0.0				,_a :	Tuple=0.1				,_a :	str="gelu"				,_a :	Tuple=0.02				,_a :	str=1E-5				,_a :	Tuple=0.0				,_a :	List[str]=None				,_a :	Optional[Any]=None				,**_a :	Optional[Any]				,):


     '''simple docstring'''






     super().__init__(**__A			)

     _a							:      Tuple     =  patch_size
     _a							:      Tuple     =  num_channels
     _a							:      Tuple     =  embed_dim
     _a							:      Union[str, Any]     =  depths
     _a							:      Optional[int]     =  len(__A			)
     _a							:      List[str]     =  num_heads
     _a							:      List[str]     =  kernel_size
     _a							:      Tuple     =  mlp_ratio
     _a							:      str     =  qkv_bias
     _a							:      int     =  hidden_dropout_prob
     _a							:      Optional[Any]     =  attention_probs_dropout_prob
     _a							:      List[str]     =  drop_path_rate
     _a							:      Union[str, Any]     =  hidden_act
     _a							:      List[Any]     =  layer_norm_eps
     _a							:      Tuple     =  initializer_range
     # we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
     # this indicates the channel dimension after the last stage of the model
     _a							:      Tuple     =  int(embed_dim * 2 ** (len(__A			) - 1)			)
     _a							:      Optional[Any]     =  layer_scale_init_value
     _a							:      Optional[Any]     =  ['stem'] + [F"""stage{idx}""" for idx in range(1				,len(__A			) + 1			)]
     _a,    _a							:      List[Any]     =  get_aligned_output_features_output_indices(
         out_features=__A				,out_indices=__A				,stage_names=self.stage_names			)










import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Value
from .base import TaskTemplate




@dataclass(frozen=UpperCamelCase__     )
class 	UpperCamelCase_							(  UpperCamelCase__     ):
							# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
							lowerCamelCase_							     =       field(default="text-classification"					,	metadata={"include_in_asdict_even_if_is_default": True}     )
							lowerCamelCase_							     =       Features({"text": Value("string"     )}     )
							lowerCamelCase_							     =       Features({"labels": ClassLabel}     )
							lowerCamelCase_							     =       "text"
							lowerCamelCase_							     =       "labels"


							def   _snake_case	(				self     :Any				,					__A     :Dict		) -> Optional[Any]:



									"""simple docstring"""



									if self.label_column not in features:
											raise ValueError(f'''Column {self.label_column} is not present in features.'''		)
									if not isinstance(features[self.label_column]				,					__A		):
											raise ValueError(f'''Column {self.label_column} is not a ClassLabel.'''		)
									SCREAMING_SNAKE_CASE__								=   copy.deepcopy(self		)
									SCREAMING_SNAKE_CASE__								=   self.label_schema.copy()
									SCREAMING_SNAKE_CASE__								=   features[self.label_column]
									SCREAMING_SNAKE_CASE__								=   label_schema
									return task_template


							@property
							def   _snake_case	(				self     :str		) -> Dict[str, str]:



									"""simple docstring"""



									return {
									    self.text_column: "text",
									    self.label_column: "labels",
									}