code: 
  
  
  
  
  
  
  from __future__ import annotations
  
  from enum import Enum, unique
  from typing import TypeVar
  
  # Create a generic variable that can be 'Enum', or any subclass.
  lowerCamelCase										=  TypeVar('''T''', bound='''Enum''')
  
  @unique
  class 					snake_case_							(       lowercase_      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
     __lowerCAmelCase      =						80
     __lowerCAmelCase      =						70
     __lowerCAmelCase      =						60
     __lowerCAmelCase      =						50
     __lowerCAmelCase      =						40
     __lowerCAmelCase      =						30
     __lowerCAmelCase      =						20
     __lowerCAmelCase      =						10
  
  
  
  
  
  
  @unique
  class 					snake_case_							(       lowercase_      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
     __lowerCAmelCase      =						24
     __lowerCAmelCase      =						21
     __lowerCAmelCase      =						18
     __lowerCAmelCase      =						15
     __lowerCAmelCase      =						12
     __lowerCAmelCase      =						9
     __lowerCAmelCase      =						6
     __lowerCAmelCase      =						3
     __lowerCAmelCase      =						2
     __lowerCAmelCase      =						1
     __lowerCAmelCase      =						-1
     __lowerCAmelCase      =						-2
     __lowerCAmelCase      =						-3
     __lowerCAmelCase      =						-6
     __lowerCAmelCase      =						-9
     __lowerCAmelCase      =						-12
     __lowerCAmelCase      =						-15
     __lowerCAmelCase      =						-18
     __lowerCAmelCase      =						-21
     __lowerCAmelCase      =						-24
  
     @classmethod
     def 			SCREAMING_SNAKE_CASE__				(    cls:	type[T]	)  ->		dict:
  
  
         """simple docstring"""
  
  
  
         return {unit.name: unit.value for unit in cls if unit.value > 0}
  
     @classmethod
     def 			SCREAMING_SNAKE_CASE__				(    cls:	type[T]	)  ->		dict:
  
  
         """simple docstring"""
  
  
  
         return {unit.name: unit.value for unit in cls if unit.value < 0}
  
  
  
  
  
  
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	SIUnit.get_positive() if value > 0 else SIUnit.get_negative()
      for name_prefix, value_prefix in prefixes.items():
          _lowercase     =	value / (10**value_prefix)
          if numerical_part > 1:
              return f'''{numerical_part!s} {name_prefix}'''
      return str(_lowercase      )
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      for prefix in BinaryUnit:
          _lowercase     =	value / (2**prefix.value)
          if numerical_part > 1:
              return f'''{numerical_part!s} {prefix.name}'''
      return str(_lowercase      )
  
  
  if __name__ == "__main__":
     import doctest
  
     doctest.testmod()
  
style_context: 
  
  
  
  
  
  
  import argparse
  
  import torch
  
  from transformers import HubertConfig, HubertForSequenceClassification, WavaVecaFeatureExtractor, logging
  
  
  logging.set_verbosity_info()
  lowerCamelCase										=  logging.get_logger(__name__)
  
  lowerCamelCase										=  ['''UtteranceLevel''']
  @torch.no_grad()
  def        UpperCAmelCase      (   _lowercase,      _lowercase,      _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	torch.load(_lowercase,      map_location='cpu'      )
      if checkpoint["Config"]["downstream_expert"]["modelrc"]["select"] not in SUPPORTED_MODELS:
          raise NotImplementedError(f'''The supported s3prl models are {SUPPORTED_MODELS}'''      )
  
      _lowercase     =	checkpoint['Downstream']
  
      _lowercase     =	HubertConfig.from_pretrained(_lowercase      )
      _lowercase     =	HubertForSequenceClassification.from_pretrained(_lowercase,      config=_lowercase      )
      _lowercase     =	WavaVecaFeatureExtractor.from_pretrained(
          _lowercase,      return_attention_mask=_lowercase,      do_normalize=_lowercase      )
  
      if hf_congfig.use_weighted_layer_sum:
          _lowercase     =	checkpoint['Featurizer']['weights']
  
      _lowercase     =	downstream_dict['projector.weight']
      _lowercase     =	downstream_dict['projector.bias']
      _lowercase     =	downstream_dict['model.post_net.linear.weight']
      _lowercase     =	downstream_dict['model.post_net.linear.bias']
  
      hf_feature_extractor.save_pretrained(_lowercase      )
      hf_model.save_pretrained(_lowercase      )
  
  
  if __name__ == "__main__":
     lowerCamelCase										=  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.''')
     lowerCamelCase										=  parser.parse_args()
     convert_saprl_checkpoint(args.base_model_name, args.config_path, args.checkpoint_path, args.model_dump_path)
  