



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


__A       =						logging.get_logger(__name__)

__A       =						{
    '''shi-labs/dinat-mini-in1k-224''': '''https://huggingface.co/shi-labs/dinat-mini-in1k-224/resolve/main/config.json''',
    # See all Dinat models at https://huggingface.co/models?filter=dinat
}






class 		lowercase						(			snake_case__			,   snake_case__):






	"""simple docstring"""


	a__				: Tuple		       =							"dinat"

	a__				: Dict		       =							{
	    "num_attention_heads": "num_heads",
	    "num_hidden_layers": "num_layers",
	}




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

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









import pytest

import datasets


# Import fixture modules as plugins
__A       =						['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec''']



def 	__a					(   lowerCAmelCase_       : Optional[Any]      ,lowerCAmelCase_       : Any    )				->			Tuple:






						'''simple docstring'''



						for item in items:
												if any(marker in item.keywords for marker in ["""integration""", """unit"""]    ):
																		continue
												item.add_marker(pytest.mark.unit    )



def 	__a					(   lowerCAmelCase_       : Tuple    )				->			Optional[Any]:






						'''simple docstring'''



						config.addinivalue_line("""markers"""      ,"""torchaudio_latest: mark test to run with torchaudio>=0.12"""    )



@pytest.fixture(autouse=lowerCAmelCase_    )
def 	__a					(   lowerCAmelCase_       : List[str]      ,lowerCAmelCase_       : List[str]    )				->			int:






						'''simple docstring'''



						UpperCAmelCase_=       tmp_path_factory.getbasetemp() / """cache"""
						UpperCAmelCase_=       test_hf_cache_home / """datasets"""
						UpperCAmelCase_=       test_hf_cache_home / """metrics"""
						UpperCAmelCase_=       test_hf_cache_home / """modules"""
						monkeypatch.setattr("""datasets.config.HF_DATASETS_CACHE"""      ,str(lowerCAmelCase_    )    )
						monkeypatch.setattr("""datasets.config.HF_METRICS_CACHE"""      ,str(lowerCAmelCase_    )    )
						monkeypatch.setattr("""datasets.config.HF_MODULES_CACHE"""      ,str(lowerCAmelCase_    )    )
						UpperCAmelCase_=       test_hf_datasets_cache / """downloads"""
						monkeypatch.setattr("""datasets.config.DOWNLOADED_DATASETS_PATH"""      ,str(lowerCAmelCase_    )    )
						UpperCAmelCase_=       test_hf_datasets_cache / """downloads""" / """extracted"""
						monkeypatch.setattr("""datasets.config.EXTRACTED_DATASETS_PATH"""      ,str(lowerCAmelCase_    )    )



@pytest.fixture(autouse=lowerCAmelCase_      ,scope="""session"""    )
def 	__a					(   )				->			Optional[int]:






						'''simple docstring'''



						datasets.disable_progress_bar()



@pytest.fixture(autouse=lowerCAmelCase_    )
def 	__a					(   lowerCAmelCase_       : int    )				->			str:






						'''simple docstring'''



						monkeypatch.setattr("""datasets.config.HF_UPDATE_DOWNLOAD_COUNTS"""      ,lowerCAmelCase_    )



@pytest.fixture
def 	__a					(   lowerCAmelCase_       : List[str]    )				->			Union[str, Any]:






						'''simple docstring'''



						monkeypatch.setattr("""sqlalchemy.util.deprecations.SILENCE_UBER_WARNING"""      ,lowerCAmelCase_    )




