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


_A      :				int 				=    logging.get_logger(__name__)

_A      :				Tuple 				=    {
    '''MCG-NJU/videomae-base''': '''https://huggingface.co/MCG-NJU/videomae-base/resolve/main/config.json''',
}







class     _lowercase					(    UpperCAmelCase__      ):


 '''simple docstring'''






 _SCREAMING_SNAKE_CASE					:	List[str]				     = """videomae"""
 def __init__(				self       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     List[Any]=2_24				,	SCREAMING_SNAKE_CASE__       :     Any=16				,	SCREAMING_SNAKE_CASE__       :     Optional[int]=3				,	SCREAMING_SNAKE_CASE__       :     Union[str, Any]=16				,	SCREAMING_SNAKE_CASE__       :     int=2				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]=7_68				,	SCREAMING_SNAKE_CASE__       :     List[str]=12				,	SCREAMING_SNAKE_CASE__       :     Tuple=12				,	SCREAMING_SNAKE_CASE__       :     str=30_72				,	SCREAMING_SNAKE_CASE__       :     Optional[int]="gelu"				,	SCREAMING_SNAKE_CASE__       :     List[Any]=0.0				,	SCREAMING_SNAKE_CASE__       :     Tuple=0.0				,	SCREAMING_SNAKE_CASE__       :     List[Any]=0.0_2				,	SCREAMING_SNAKE_CASE__       :     Any=1e-1_2				,	SCREAMING_SNAKE_CASE__       :     List[Any]=True				,	SCREAMING_SNAKE_CASE__       :     List[Any]=True				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]=6				,	SCREAMING_SNAKE_CASE__       :     str=3_84				,	SCREAMING_SNAKE_CASE__       :     Dict=4				,	SCREAMING_SNAKE_CASE__       :     int=15_36				,	SCREAMING_SNAKE_CASE__       :     List[Any]=True				,	**SCREAMING_SNAKE_CASE__       :     int				,	)  ->   str:
  super().__init__(**SCREAMING_SNAKE_CASE__							)

  __lowerCAmelCase    							=						image_size
  __lowerCAmelCase    							=						patch_size
  __lowerCAmelCase    							=						num_channels
  __lowerCAmelCase    							=						num_frames
  __lowerCAmelCase    							=						tubelet_size

  __lowerCAmelCase    							=						hidden_size
  __lowerCAmelCase    							=						num_hidden_layers
  __lowerCAmelCase    							=						num_attention_heads
  __lowerCAmelCase    							=						intermediate_size
  __lowerCAmelCase    							=						hidden_act
  __lowerCAmelCase    							=						hidden_dropout_prob
  __lowerCAmelCase    							=						attention_probs_dropout_prob
  __lowerCAmelCase    							=						initializer_range
  __lowerCAmelCase    							=						layer_norm_eps
  __lowerCAmelCase    							=						qkv_bias
  __lowerCAmelCase    							=						use_mean_pooling

  __lowerCAmelCase    							=						decoder_num_attention_heads
  __lowerCAmelCase    							=						decoder_hidden_size
  __lowerCAmelCase    							=						decoder_num_hidden_layers
  __lowerCAmelCase    							=						decoder_intermediate_size
  __lowerCAmelCase    							=						norm_pix_loss







'''simple docstring'''

import argparse

from transformers import CanineConfig, CanineModel, CanineTokenizer, load_tf_weights_in_canine
from transformers.utils import logging


logging.set_verbosity_info()







def 					UpperCamelCase_						( snake_case_	:	List[str]						,		snake_case_	:	Optional[Any]				) ->					Tuple:






 '''simple docstring'''

 __lowerCAmelCase    							=						CanineConfig()
 __lowerCAmelCase    							=						CanineModel(snake_case_				)
 model.eval()

 print(f"""Building PyTorch model from configuration: {config}"""				)

 # Load weights from tf checkpoint
 load_tf_weights_in_canine(snake_case_						,		snake_case_						,		snake_case_				)

 # Save pytorch-model (weights and configuration)
 print(f"""Save PyTorch model to {pytorch_dump_path}"""				)
 model.save_pretrained(snake_case_				)

 # Save tokenizer files
 __lowerCAmelCase    							=						CanineTokenizer()
 print(f"""Save tokenizer files to {pytorch_dump_path}"""				)
 tokenizer.save_pretrained(snake_case_				)


if __name__ == "__main__":
 _A      :				int 				=    argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     '''--tf_checkpoint_path''',
     default=None,
     type=str,
     required=True,
     help='''Path to the TensorFlow checkpoint. Should end with model.ckpt''',
 )
 parser.add_argument(
     '''--pytorch_dump_path''',
     default=None,
     type=str,
     required=True,
     help='''Path to a folder where the PyTorch model will be placed.''',
 )
 _A      :				Dict 				=    parser.parse_args()
 convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.pytorch_dump_path)






