





import argparse

import torch

from transformers import (
    WavaVecaFeatureExtractor,
    WavLMConfig,
    WavLMForAudioFrameClassification,
    WavLMForSequenceClassification,
    WavLMForXVector,
    logging,
)


logging.set_verbosity_info()
_UpperCamelCase   :							Optional[Any]     =	logging.get_logger(__name__)
def 				__UpperCamelCase  (		snake_case    ,	snake_case    ,	snake_case     )  ->						Any:


   '''simple docstring'''







   __A				 =       WavLMForSequenceClassification.from_pretrained(snake_case    ,	config=snake_case     )
   __A				 =       downstream_dict['''projector.weight''']
   __A				 =       downstream_dict['''projector.bias''']
   __A				 =       downstream_dict['''model.post_net.linear.weight''']
   __A				 =       downstream_dict['''model.post_net.linear.bias''']
   return model
def 				__UpperCamelCase  (		snake_case    ,	snake_case    ,	snake_case     )  ->						Optional[int]:


   '''simple docstring'''







   __A				 =       WavLMForAudioFrameClassification.from_pretrained(snake_case    ,	config=snake_case     )
   __A				 =       downstream_dict['''model.linear.weight''']
   __A				 =       downstream_dict['''model.linear.bias''']
   return model
def 				__UpperCamelCase  (		snake_case    ,	snake_case    ,	snake_case     )  ->						Any:


   '''simple docstring'''







   __A				 =       WavLMForXVector.from_pretrained(snake_case    ,	config=snake_case     )
   __A				 =       downstream_dict['''connector.weight''']
   __A				 =       downstream_dict['''connector.bias''']
   for i, kernel_size in enumerate(hf_config.tdnn_kernel     ):
      __A				 =       downstream_dict[
          F"model.framelevel_feature_extractor.module.{i}.kernel.weight"
      ]
      __A				 =       downstream_dict[F"model.framelevel_feature_extractor.module.{i}.kernel.bias"]

   __A				 =       downstream_dict['''model.utterancelevel_feature_extractor.linear1.weight''']
   __A				 =       downstream_dict['''model.utterancelevel_feature_extractor.linear1.bias''']
   __A				 =       downstream_dict['''model.utterancelevel_feature_extractor.linear2.weight''']
   __A				 =       downstream_dict['''model.utterancelevel_feature_extractor.linear2.bias''']
   __A				 =       downstream_dict['''objective.W''']
   return model
@torch.no_grad()
def 				__UpperCamelCase  (		snake_case    ,	snake_case    ,	snake_case    ,	snake_case     )  ->						Optional[int]:


   '''simple docstring'''







   __A				 =       torch.load(snake_case    ,	map_location='''cpu'''     )

   __A				 =       checkpoint['''Downstream''']

   __A				 =       WavLMConfig.from_pretrained(snake_case     )
   __A				 =       WavaVecaFeatureExtractor.from_pretrained(
       snake_case    ,	return_attention_mask=snake_case    ,	do_normalize=snake_case     )

   __A				 =       hf_config.architectures[0]
   if arch.endswith('''ForSequenceClassification'''     ):
      __A				 =       convert_classification(snake_case    ,	snake_case    ,	snake_case     )
   elif arch.endswith('''ForAudioFrameClassification'''     ):
      __A				 =       convert_diarization(snake_case    ,	snake_case    ,	snake_case     )
   elif arch.endswith('''ForXVector'''     ):
      __A				 =       convert_xvector(snake_case    ,	snake_case    ,	snake_case     )
   else:
      raise NotImplementedError(F"S3PRL weights conversion is not supported for {arch}"     )

   if hf_config.use_weighted_layer_sum:
      __A				 =       checkpoint['''Featurizer''']['''weights''']

   hf_feature_extractor.save_pretrained(snake_case     )
   hf_model.save_pretrained(snake_case     )


if __name__ == "__main__":
     _UpperCamelCase   :							List[Any]     =	argparse.ArgumentParser()
     parser.add_argument(
         """--base_model_name""", default=None, type=str, help="""Name of the huggingface pretrained base model."""
     )
     parser.add_argument("""--config_path""", default=None, type=str, help="""Path to the huggingface classifier config.""")
     parser.add_argument("""--checkpoint_path""", default=None, type=str, help="""Path to the s3prl checkpoint.""")
     parser.add_argument("""--model_dump_path""", default=None, type=str, help="""Path to the final converted model.""")
     _UpperCamelCase   :							Tuple     =	parser.parse_args()
     convert_saprl_checkpoint(args.base_model_name, args.config_path, args.checkpoint_path, args.model_dump_path)








def 				__UpperCamelCase  (		snake_case = 1_0_0     )  ->						int:


   '''simple docstring'''







   __A				 =       [[0 for _ in range(snake_case     )] for _ in range(m + 1     )]
   for i in range(m + 1     ):
      __A				 =       1

   for n in range(m + 1     ):
      for k in range(1    ,	snake_case     ):
         memo[n][k] += memo[n][k - 1]
         if n > k:
            memo[n][k] += memo[n - k - 1][k]

   return memo[m][m - 1] - 1


if __name__ == "__main__":
    print(solution(int(input("""Enter a number: """).strip())))

