


"""simple docstring"""





import argparse

import torch

from transformers import HubertConfig, HubertForSequenceClassification, WavaVecaFeatureExtractor, logging


logging.set_verbosity_info()
__UpperCAmelCase    				=      logging.get_logger(__name__)

__UpperCAmelCase    				=      ["UtteranceLevel"]





@torch.no_grad()
def     lowercase__	(  lowerCamelCase     :  Union[str, Any]				,	lowerCamelCase     :  Any				,	lowerCamelCase     :  int				,	lowerCamelCase     :  List[str]				)					->     List[Any]:
  lowerCAmelCase__    :    str								=					torch.load(lowerCamelCase				,	map_location="cpu"				)
  if checkpoint["Config"]["downstream_expert"]["modelrc"]["select"] not in SUPPORTED_MODELS:
    raise NotImplementedError(F"The supported s3prl models are {SUPPORTED_MODELS}"				)

  lowerCAmelCase__    :    str								=					checkpoint["Downstream"]

  lowerCAmelCase__    :    Any								=					HubertConfig.from_pretrained(lowerCamelCase				)
  lowerCAmelCase__    :    Tuple								=					HubertForSequenceClassification.from_pretrained(lowerCamelCase				,	config=lowerCamelCase				)
  lowerCAmelCase__    :    int								=					WavaVecaFeatureExtractor.from_pretrained(
      lowerCamelCase				,	return_attention_mask=lowerCamelCase				,	do_normalize=lowerCamelCase				)

  if hf_congfig.use_weighted_layer_sum:
    lowerCAmelCase__    :    List[str]								=					checkpoint["Featurizer"]["weights"]

  lowerCAmelCase__    :    Union[str, Any]								=					downstream_dict["projector.weight"]
  lowerCAmelCase__    :    Tuple								=					downstream_dict["projector.bias"]
  lowerCAmelCase__    :    Any								=					downstream_dict["model.post_net.linear.weight"]
  lowerCAmelCase__    :    Optional[Any]								=					downstream_dict["model.post_net.linear.bias"]

  hf_feature_extractor.save_pretrained(lowerCamelCase				)
  hf_model.save_pretrained(lowerCamelCase				)


if __name__ == "__main__":
   __UpperCAmelCase    				=      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    				=      parser.parse_args()
   convert_saprl_checkpoint(args.base_model_name, args.config_path, args.checkpoint_path, args.model_dump_path)




"""simple docstring"""





from math import factorial





def     lowercase__	(  lowerCamelCase     :  Dict				,	lowerCamelCase     :  int				)					->     Tuple:
  return factorial(lowerCamelCase				) / (factorial(lowerCamelCase				) * factorial(n - r				))





def     lowercase__	(  )					->     Optional[Any]:
  lowerCAmelCase__    :    List[Any]								=					0

  for i in range(1				,	1_0_1				):
    for j in range(1				,	i + 1				):
      if combinations(lowerCamelCase				,	lowerCamelCase				) > 1e6:
        total += 1
  return total


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