
import argparse

import torch

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


logging.set_verbosity_info()


def 							__A(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )		->				Dict:

		"""simple docstring"""






		_UpperCamelCase						    =	RemBertConfig.from_json_file(__UpperCamelCase )
		print("""Building PyTorch model from configuration: {}""".format(str(__UpperCamelCase ) ) )
		_UpperCamelCase						    =	RemBertModel(__UpperCamelCase )

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

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


if __name__ == "__main__":
						lowerCamelCase__	=							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."
						)
						lowerCamelCase__	=							parser.parse_args()
						convert_rembert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.rembert_config_file, args.pytorch_dump_path)





def 							__A(lowerCAmelCase )		->				list[list[int]]:

		"""simple docstring"""






		_UpperCamelCase						    =	[]
		if len(lowerCAmelCase ) == 1:
				return [nums.copy()]
		for _ in range(len(lowerCAmelCase ) ):
				_UpperCamelCase						    =	nums.pop(0 )
				_UpperCamelCase						    =	permute(lowerCAmelCase )
				for perm in permutations:
						perm.append(lowerCAmelCase )
				result.extend(lowerCAmelCase )
				nums.append(lowerCAmelCase )
		return result


def 							__A(lowerCAmelCase )		->				Optional[int]:

		"""simple docstring"""






		def backtrack(lowerCAmelCase ):
				if start == len(lowerCAmelCase ) - 1:
						output.append(nums[:] )
				else:
						for i in range(lowerCAmelCase						,  len(lowerCAmelCase ) ):
								_UpperCamelCase    ,	_UpperCamelCase						    =	nums[i], nums[start]
								backtrack(start + 1 )
								_UpperCamelCase    ,	_UpperCamelCase						    =	nums[i], nums[start]  # backtrack

		_UpperCamelCase						    =	[]
		backtrack(0 )
		return output


if __name__ == "__main__":
		import doctest

		# use res to print the data in permute2 function
		lowerCamelCase__	=							permutea([1, 2, 3])
		print(res)
		doctest.testmod()



