



"""simple docstring"""






import argparse

import torch
from torch import nn

from transformers import MBartConfig, MBartForConditionalGeneration






def        snake_case_  (      A_					:		Any						):


       '''simple docstring'''





       _lowerCamelCase						:				Any    			= [
           '''encoder.version''',
           '''decoder.version''',
           '''model.encoder.version''',
           '''model.decoder.version''',
           '''_float_tensor''',
           '''decoder.output_projection.weight''',
       ]
       for k in ignore_keys:
              state_dict.pop(A_,				A_						)






def        snake_case_  (      A_					:		Union[str, Any]						):


       '''simple docstring'''





       _lowerCamelCase			,    _lowerCamelCase						:				Tuple    			= emb.weight.shape
       _lowerCamelCase						:				Dict    			= nn.Linear(A_,				A_,				bias=A_						)
       _lowerCamelCase						:				str    			= emb.weight.data
       return lin_layer






def        snake_case_  (      A_					:		str,				A_					:		Optional[int]="facebook/mbart-large-en-ro",				A_					:		Union[str, Any]=False,				A_					:		List[str]=False						):


       '''simple docstring'''





       _lowerCamelCase						:				Tuple    			= torch.load(A_,				map_location='''cpu'''						)['''model''']
       remove_ignore_keys_(A_						)
       _lowerCamelCase						:				int    			= state_dict['''encoder.embed_tokens.weight'''].shape[0]

       _lowerCamelCase						:				Any    			= MBartConfig.from_pretrained(A_,				vocab_size=A_						)
       if mbart_aa and finetuned:
              _lowerCamelCase						:				Any    			= '''relu'''

       _lowerCamelCase						:				Optional[int]    			= state_dict['''decoder.embed_tokens.weight''']
       _lowerCamelCase						:				Any    			= MBartForConditionalGeneration(A_						)
       model.model.load_state_dict(A_						)

       if finetuned:
              _lowerCamelCase						:				str    			= make_linear_from_emb(model.model.shared						)

       return model


if __name__ == "__main__":
   lowerCAmelCase__        =				argparse.ArgumentParser()
   # Required parameters
   parser.add_argument(
       '''fairseq_path''', type=str, help='''bart.large, bart.large.cnn or a path to a model.pt on local filesystem.'''
   )
   parser.add_argument('''pytorch_dump_folder_path''', default=None, type=str, help='''Path to the output PyTorch model.''')
   parser.add_argument(
       '''--hf_config''',
       default='''facebook/mbart-large-cc25''',
       type=str,
       help='''Which huggingface architecture to use: mbart-large''',
   )
   parser.add_argument('''--mbart_50''', action='''store_true''', help='''whether the model is mMART-50 checkpoint''')
   parser.add_argument('''--finetuned''', action='''store_true''', help='''whether the model is a fine-tuned checkpoint''')
   lowerCAmelCase__        =				parser.parse_args()
   lowerCAmelCase__        =				convert_fairseq_mbart_checkpoint_from_disk(
       args.fairseq_path, hf_config_path=args.hf_config, finetuned=args.finetuned, mbart_aa=args.mbart_aa
   )
   model.save_pretrained(args.pytorch_dump_folder_path)





from math import factorial

def 						UpperCamelCase					(lowercase_: int = 20					)     ->      int:
	A__							:    Union[str, Any]        =		2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
	# 2, 3,...
	A__							:    Tuple        =		n // 2

	return int(factorial(lowercase_					) / (factorial(lowercase_					) * factorial(n - k					))					)


if __name__ == "__main__":
	import sys

	if len(sys.argv) == 1:
		print(solution(20))
	else:
		try:
			A_       : List[str]         =			int(sys.argv[1])
			print(solution(n))
		except ValueError:
			print('Invalid entry - please enter a number.')



