





import argparse

import torch
from torch import nn

from transformers import MBartConfig, MBartForConditionalGeneration







def       UpperCAmelCase							(     _lowerCamelCase      :  Any     ):





						'''simple docstring'''


						SCREAMING_SNAKE_CASE__     :				List[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(_lowerCamelCase			,   _lowerCamelCase     )







def       UpperCAmelCase							(     _lowerCamelCase      :  Any     ):





						'''simple docstring'''


						SCREAMING_SNAKE_CASE__     :				Optional[int]   =					emb.weight.shape
						SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					nn.Linear(_lowerCamelCase			,   _lowerCamelCase			,   bias=_lowerCamelCase     )
						SCREAMING_SNAKE_CASE__     :				Any   =					emb.weight.data
						return lin_layer







def       UpperCAmelCase							(     _lowerCamelCase      :  List[Any]			,   _lowerCamelCase      :  int="facebook/mbart-large-en-ro"			,   _lowerCamelCase      :  Tuple=False			,   _lowerCamelCase      :  Optional[int]=False     ):





						'''simple docstring'''


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

						SCREAMING_SNAKE_CASE__     :				int   =					MBartConfig.from_pretrained(_lowerCamelCase			,   vocab_size=_lowerCamelCase     )
						if mbart_aa and finetuned:
												SCREAMING_SNAKE_CASE__     :				Optional[int]   =					"relu"

						SCREAMING_SNAKE_CASE__     :				Any   =					state_dict["decoder.embed_tokens.weight"]
						SCREAMING_SNAKE_CASE__     :				List[Any]   =					MBartForConditionalGeneration(_lowerCamelCase     )
						model.model.load_state_dict(_lowerCamelCase     )

						if finetuned:
												SCREAMING_SNAKE_CASE__     :				List[str]   =					make_linear_from_emb(model.model.shared     )

						return model


if __name__ == "__main__":
				__lowercase       :Any       =  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")
				__lowercase       :Dict       =  parser.parse_args()
				__lowercase       :Union[str, Any]       =  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)










def       UpperCAmelCase							(     _lowerCamelCase      :  int = 4_000_000     ):





						'''simple docstring'''


						SCREAMING_SNAKE_CASE__     :				Any   =					[0, 1]
						SCREAMING_SNAKE_CASE__     :				List[Any]   =					0
						while fib[i] <= n:
												fib.append(fib[i] + fib[i + 1]     )
												if fib[i + 2] > n:
																		break
												i += 1
						SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					0
						for j in range(len(_lowerCamelCase     ) - 1     ):
												if fib[j] % 2 == 0:
																		total += fib[j]

						return total


if __name__ == "__main__":
				print(f"{solution() = }")