code: 
  
  
  
  
  """simple docstring"""
  
  
  
  
  import argparse
  
  import torch
  
  from transformers import HubertConfig, HubertForSequenceClassification, WavaVecaFeatureExtractor, logging
  
  
  logging.set_verbosity_info()
  __A :		str      							=    logging.get_logger(__name__)
  
  __A :		List[str]      							=    ['''UtteranceLevel''']
  @torch.no_grad()
  def 					A_			(		snake_case_     :       Optional[int]						,snake_case_     :       int						,snake_case_     :       List[str]						,snake_case_     :       Union[str, Any]    ):
  
  
  
  
  
  
  
      '''simple docstring'''
      UpperCamelCase				:   Dict          =							torch.load(snake_case_						,map_location="""cpu"""    )
      if checkpoint["Config"]["downstream_expert"]["modelrc"]["select"] not in SUPPORTED_MODELS:
          raise NotImplementedError(f'The supported s3prl models are {SUPPORTED_MODELS}'    )
  
      UpperCamelCase				:   str          =							checkpoint["""Downstream"""]
  
      UpperCamelCase				:   Dict          =							HubertConfig.from_pretrained(snake_case_    )
      UpperCamelCase				:   Optional[int]          =							HubertForSequenceClassification.from_pretrained(snake_case_						,config=snake_case_    )
      UpperCamelCase				:   Tuple          =							WavaVecaFeatureExtractor.from_pretrained(
          snake_case_						,return_attention_mask=snake_case_						,do_normalize=snake_case_    )
  
      if hf_congfig.use_weighted_layer_sum:
          UpperCamelCase				:   List[Any]          =							checkpoint["""Featurizer"""]["""weights"""]
  
      UpperCamelCase				:   Dict          =							downstream_dict["""projector.weight"""]
      UpperCamelCase				:   Optional[int]          =							downstream_dict["""projector.bias"""]
      UpperCamelCase				:   Optional[Any]          =							downstream_dict["""model.post_net.linear.weight"""]
      UpperCamelCase				:   List[str]          =							downstream_dict["""model.post_net.linear.bias"""]
  
      hf_feature_extractor.save_pretrained(snake_case_    )
      hf_model.save_pretrained(snake_case_    )
  
  
  if __name__ == "__main__":
    __A :		int      							=    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.''')
    __A :		int      							=    parser.parse_args()
    convert_saprl_checkpoint(args.base_model_name, args.config_path, args.checkpoint_path, args.model_dump_path)
  
  
  
  
  
style_context: 
  
  
  
  
  """simple docstring"""
  
  
  
  
  from ...utils import is_transformers_available
  from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline
  
  
  if is_transformers_available():
    from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline
  
  
  
  
  