



"""simple docstring"""






import argparse

import torch

from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert
from transformers.utils import logging


logging.set_verbosity_info()






def 					snake_case__       (		__lowerCamelCase    :   Tuple							,		__lowerCamelCase    :   List[Any]							,		__lowerCamelCase    :   str     ):
			"""simple docstring"""
			# Initialise PyTorch model
			lowerCamelCase__		:		Any		     =RemBertConfig.from_json_file(__lowerCamelCase     )
			print('''Building PyTorch model from configuration: {}'''.format(str(__lowerCamelCase     )     )     )
			lowerCamelCase__		:		str		     =RemBertModel(__lowerCamelCase     )

			# Load weights from tf checkpoint
			load_tf_weights_in_rembert(__lowerCamelCase							,		__lowerCamelCase							,		__lowerCamelCase     )

			# Save pytorch-model
			print('''Save PyTorch model to {}'''.format(__lowerCamelCase     )     )
			torch.save(model.state_dict()							,		__lowerCamelCase     )


if __name__ == "__main__":
		_lowercase			:			Union[str, Any]										=						argparse.ArgumentParser()
		# Required parameters
		parser.add_argument(
		    "--tf_checkpoint_path", default=None, type=str, required=True, help="Path to the TensorFlow checkpoint path."
		)
		parser.add_argument(
		    "--rembert_config_file",
		    default=None,
		    type=str,
		    required=True,
		    help=(
		        "The config json file corresponding to the pre-trained RemBERT model. \n"
		        "This specifies the model architecture."
		    ),
		)
		parser.add_argument(
		    "--pytorch_dump_path", default=None, type=str, required=True, help="Path to the output PyTorch model."
		)
		_lowercase			:			Tuple										=						parser.parse_args()
		convert_rembert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.rembert_config_file, args.pytorch_dump_path)









"""simple docstring"""






from ..utils import DummyObject, requires_backends

class 	__SCREAMING_SNAKE_CASE     (				metaclass=lowerCAmelCase_       ):


					'''simple docstring'''





					_a             =							['torch', 'torchsde']



					def __init__(	self							:  Union[str, Any],  *lowerCamelCase							:  str,  **lowerCamelCase							:  int					)-> Tuple:
								requires_backends(self,  ['''torch''', '''torchsde''']					)



					@classmethod
					def 		snake_case	(	cls							:  List[str],  *lowerCamelCase							:  Optional[Any],  **lowerCamelCase							:  Dict					)-> str:
								requires_backends(cls,  ['''torch''', '''torchsde''']					)




					@classmethod
					def 		snake_case	(	cls							:  Tuple,  *lowerCamelCase							:  Dict,  **lowerCamelCase							:  Tuple					)-> List[str]:
								requires_backends(cls,  ['''torch''', '''torchsde''']					)




