




import argparse

import torch

from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel
from transformers.utils import logging


logging.set_verbosity_info()





def        __UpperCAmelCase						(							lowerCamelCase_ :     Dict  ,							lowerCamelCase_ :     Any  ,							lowerCamelCase_ :     int  ,							lowerCamelCase_ :     List[Any]  )       ->  int:







			"""simple docstring"""





			SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      FunnelConfig.from_json_file(lowerCamelCase_  )
			print(F'Building PyTorch model from configuration: {config}'  )
			SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      FunnelBaseModel(lowerCamelCase_  ) if base_model else FunnelModel(lowerCamelCase_  )

			# Load weights from tf checkpoint
			load_tf_weights_in_funnel(lowerCamelCase_  ,							lowerCamelCase_  ,							lowerCamelCase_  )

			# Save pytorch-model
			print(F'Save PyTorch model to {pytorch_dump_path}'  )
			torch.save(model.state_dict()  ,							lowerCamelCase_  )


if __name__ == "__main__":
						UpperCamelCase__ :   Optional[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(
						    '''--config_file''',
						    default=None,
						    type=str,
						    required=True,
						    help='''The config json file corresponding to the pre-trained model. \nThis specifies the model architecture.''',
						)
						parser.add_argument(
						    '''--pytorch_dump_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
						)
						parser.add_argument(
						    '''--base_model''', action='''store_true''', help='''Whether you want just the base model (no decoder) or not.'''
						)
						UpperCamelCase__ :   Tuple						=							parser.parse_args()
						convert_tf_checkpoint_to_pytorch(
						    args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path, args.base_model
						)





def 				__A(lowerCAmelCase			)		->					bool:

		"""simple docstring"""






		if not isinstance(lowerCAmelCase    ,	lowerCAmelCase			):
				raise ValueError("""check_bouncy() accepts only integer arguments"""			)
		_UpperCamelCase         =						str(lowerCAmelCase			)
		_UpperCamelCase         =						"""""".join(sorted(lowerCAmelCase			)			)
		return sorted_str_n != str_n and sorted_str_n[::-1] != str_n


def 				__A(lowerCAmelCase = 9_9			)		->					int:

		"""simple docstring"""






		if not 0 < percent < 1_0_0:
				raise ValueError("""solution() only accepts values from 0 to 100"""			)
		_UpperCamelCase         =						0
		_UpperCamelCase         =						1

		while True:
				if check_bouncy(lowerCAmelCase			):
						bouncy_num += 1
				if (bouncy_num / num) * 1_0_0 >= percent:
						return num
				num += 1


if __name__ == "__main__":
		from doctest import testmod

		testmod()
		print(F"""{solution(99)}""")



