






"""simple docstring"""



import argparse

import torch
from torch import nn

from transformers import PLBartConfig, PLBartForConditionalGeneration, PLBartForSequenceClassification
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  Optional[Any]   ):





  '''simple docstring'''





  lowercase							   =	[
      'encoder.version',
      'decoder.version',
      'model.encoder.version',
      'model.decoder.version',
      '_float_tensor',
      'decoder.output_projection.weight',
  ]
  for k in ignore_keys:
    state_dict.pop(__snake_case		, __snake_case   )
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  List[str]   ):





  '''simple docstring'''





  lowercase   ,					lowercase							   =	emb.weight.shape
  lowercase							   =	nn.Linear(__snake_case		, __snake_case		, bias=__snake_case   )
  lowercase							   =	emb.weight.data
  return lin_layer
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  Union[str, Any]		, __snake_case      :  Any="uclanlp/plbart-base"		, __snake_case      :  Dict=False		, __snake_case      :  Union[str, Any]=False   ):





  '''simple docstring'''





  lowercase							   =	torch.load(__snake_case		, map_location='cpu'   )['model']
  remove_ignore_keys_(__snake_case   )
  lowercase							   =	state_dict['encoder.embed_tokens.weight'].shape[0]

  lowercase							   =	PLBartConfig.from_pretrained(__snake_case		, vocab_size=__snake_case   )

  lowercase							   =	state_dict['decoder.embed_tokens.weight']
  if not classification:
    lowercase							   =	PLBartForConditionalGeneration(__snake_case   )
    model.model.load_state_dict(__snake_case   )
    if finetuned:
      lowercase							   =	make_linear_from_emb(model.model.shared   )

  else:
    lowercase							   =	{}
    for key, value in state_dict.copy().items():
      if key.startswith('classification_heads.sentence_classification_head'   ):
        lowercase							   =	value
        state_dict.pop(__snake_case   )
    lowercase							   =	PLBartForSequenceClassification(__snake_case   )
    model.model.load_state_dict(__snake_case   )
    model.classification_head.load_state_dict(__snake_case   )

  return model


if __name__ == "__main__":
    _UpperCamelCase		:  Optional[Any]						=		argparse.ArgumentParser()
    # Required parameters
    parser.add_argument('fairseq_path', type=str, help='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='uclanlp/plbart-base',
        type=str,
        help='Which huggingface architecture to use: plbart-base',
    )
    parser.add_argument('--finetuned', action='store_true', help='whether the model is a fine-tuned checkpoint')
    parser.add_argument(
        '--classification', action='store_true', help='whether the model is a classification checkpoint'
    )
    _UpperCamelCase		:  List[str]						=		parser.parse_args()
    _UpperCamelCase		:  List[str]						=		convert_fairseq_plbart_checkpoint_from_disk(
        args.fairseq_path,
        hf_config_path=args.hf_config,
        finetuned=args.finetuned,
        classification=args.classification,
    )
    model.save_pretrained(args.pytorch_dump_folder_path)










"""simple docstring"""



_UpperCamelCase		:  str						=		1_0**8
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  int   ):





  '''simple docstring'''





  if n % 10 == 0:
    return False
  lowercase							   =	str(__snake_case   )
  return s == s[::-1]
def 						_SCREAMING_SNAKE_CASE			(   ):





  '''simple docstring'''





  lowercase							   =	set()
  lowercase							   =	1
  lowercase							   =	5
  while sum_squares < LIMIT:
    lowercase							   =	first_square + 1
    while sum_squares < LIMIT:
      if is_palindrome(__snake_case   ):
        answer.add(__snake_case   )
      last_square += 1
      sum_squares += last_square**2
    first_square += 1
    lowercase							   =	first_square**2 + (first_square + 1) ** 2

  return sum(__snake_case   )


if __name__ == "__main__":
    print(solution())


