




from ....configuration_utils import PretrainedConfig
from ....utils import logging


lowerCAmelCase_						=			logging.get_logger(__name__)

lowerCAmelCase_						=			{
    'Visual-Attention-Network/van-base': (
        'https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json'
    ),
}
class 						_A (  _lowerCamelCase				):
  _UpperCamelCase       :      Dict			=      '''van'''






  def __init__(  self		:     Optional[Any]				,						_A		:     Union[str, Any]=224				,						_A		:     Optional[int]=3				,						_A		:     str=[7, 3, 3, 3]				,						_A		:     Optional[Any]=[4, 2, 2, 2]				,						_A		:     str=[64, 128, 320, 512]				,						_A		:     str=[3, 3, 12, 3]				,						_A		:     Union[str, Any]=[8, 8, 4, 4]				,						_A		:     int="gelu"				,						_A		:     Any=0.02				,						_A		:     Optional[Any]=1E-6				,						_A		:     int=1E-2				,						_A		:     Optional[int]=0.0				,						_A		:     List[Any]=0.0				,						**_A		:     str				,						)		->   Optional[int]:






       """simple docstring"""







       super().__init__(**_A				)
       lowercase :       Dict       =			image_size
       lowercase :       Tuple       =			num_channels
       lowercase :       Tuple       =			patch_sizes
       lowercase :       List[str]       =			strides
       lowercase :       str       =			hidden_sizes
       lowercase :       List[Any]       =			depths
       lowercase :       str       =			mlp_ratios
       lowercase :       Tuple       =			hidden_act
       lowercase :       List[str]       =			initializer_range
       lowercase :       str       =			layer_norm_eps
       lowercase :       List[str]       =			layer_scale_init_value
       lowercase :       int       =			drop_path_rate
       lowercase :       int       =			dropout_rate





from typing import Union

import fire
import torch
from tqdm import tqdm






def  snake_case(    __magic_name__			,		__magic_name__ = "cpu"			,		__magic_name__ = None   )			->							None:





     '''simple docstring'''


     lowercase :       int       =			torch.load(__magic_name__			,		map_location=__magic_name__   )
     for k, v in tqdm(state_dict.items()   ):
          if not isinstance(__magic_name__			,		torch.Tensor   ):
               raise TypeError('''FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'''   )
          lowercase :       Any       =			v.half()
     if save_path is None:  # overwrite src_path
          lowercase :       str       =			src_path
     torch.save(__magic_name__			,		__magic_name__   )


if __name__ == "__main__":
 fire.Fire(convert)