code: 
  
  
  
  """simple docstring"""
  
  
  
  
  import copy
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  from ..auto.configuration_auto import AutoConfig
  
  
  _lowerCAmelCase       :      Tuple							=							logging.get_logger(__name__)
  
  _lowerCAmelCase       :      Optional[Any]							=							{
      "facebook/musicgen-small": "https://huggingface.co/facebook/musicgen-small/resolve/main/config.json",
      # See all Musicgen models at https://huggingface.co/models?filter=musicgen
  }
  
  
  
  
  
  
  class 			UpperCAmelCase_						(       _UpperCamelCase		):
        __SCREAMING_SNAKE_CASE		:     Union[str, Any]				  =				'musicgen_decoder'
        __SCREAMING_SNAKE_CASE		:     Dict				  =				['past_key_values']
  
  
  
        def __init__(  self  :			Optional[int]  ,			A  :			int=2_0_4_8  ,			A  :			Tuple=2_0_4_8  ,			A  :			Optional[Any]=2_4  ,			A  :			Tuple=4_0_9_6  ,			A  :			Tuple=1_6  ,			A  :			Union[str, Any]=0.0  ,			A  :			List[Any]=True  ,			A  :			int="gelu"  ,			A  :			Union[str, Any]=1_0_2_4  ,			A  :			str=0.1  ,			A  :			Optional[Any]=0.0  ,			A  :			Dict=0.0  ,			A  :			str=0.02  ,			A  :			List[str]=False  ,			A  :			Optional[int]=4  ,			A  :			List[str]=2_0_4_8  ,			A  :			Optional[Any]=2_0_4_8  ,			A  :			Tuple=None  ,			A  :			Optional[Any]=False  ,			**A  :			str  ,			):
             _UpperCAmelCase    :			Optional[int]              =					vocab_size
             _UpperCAmelCase    :			Any              =					max_position_embeddings
             _UpperCAmelCase    :			Optional[int]              =					hidden_size
             _UpperCAmelCase    :			Optional[Any]              =					ffn_dim
             _UpperCAmelCase    :			List[Any]              =					num_hidden_layers
             _UpperCAmelCase    :			int              =					num_attention_heads
             _UpperCAmelCase    :			int              =					dropout
             _UpperCAmelCase    :			List[str]              =					attention_dropout
             _UpperCAmelCase    :			Optional[int]              =					activation_dropout
             _UpperCAmelCase    :			Any              =					activation_function
             _UpperCAmelCase    :			Optional[Any]              =					initializer_factor
             _UpperCAmelCase    :			Optional[int]              =					layerdrop
             _UpperCAmelCase    :			Dict              =					use_cache
             _UpperCAmelCase    :			int              =					scale_embedding  # scale factor will be sqrt(d_model) if True
             _UpperCAmelCase    :			Optional[int]              =					num_codebooks
             super().__init__(
                 pad_token_id=A  ,			bos_token_id=A  ,			eos_token_id=A  ,			tie_word_embeddings=A  ,			**A  ,			)
  
  
  
  
  
  
  
  class 			UpperCAmelCase_						(       _UpperCamelCase		):
        __SCREAMING_SNAKE_CASE		:     Optional[int]				  =				'musicgen'
        __SCREAMING_SNAKE_CASE		:     Dict				  =				True
  
  
  
        def __init__(  self  :			int  ,			**A  :			Any		):
             super().__init__(**A		)
             if "text_encoder" not in kwargs or "audio_encoder" not in kwargs or "decoder" not in kwargs:
                  raise ValueError("Config has to be initialized with text_encoder, audio_encoder and decoder config"		)
  
             _UpperCAmelCase    :			List[str]              =					kwargs.pop("text_encoder"		)
             _UpperCAmelCase    :			List[str]              =					text_encoder_config.pop("model_type"		)
  
             _UpperCAmelCase    :			Union[str, Any]              =					kwargs.pop("audio_encoder"		)
             _UpperCAmelCase    :			Any              =					audio_encoder_config.pop("model_type"		)
  
             _UpperCAmelCase    :			Optional[int]              =					kwargs.pop("decoder"		)
  
             _UpperCAmelCase    :			List[str]              =					AutoConfig.for_model(A  ,			**A		)
             _UpperCAmelCase    :			Tuple              =					AutoConfig.for_model(A  ,			**A		)
             _UpperCAmelCase    :			Any              =					MusicgenDecoderConfig(**A		)
             _UpperCAmelCase    :			Union[str, Any]              =					True
  
  
  
        @classmethod
        def 		snake_case_      (  cls  :			int  ,			A  :			PretrainedConfig  ,			A  :			PretrainedConfig  ,			A  :			MusicgenDecoderConfig  ,			**A  :			Tuple  ,			):
             return cls(
                 text_encoder=text_encoder_config.to_dict()  ,			audio_encoder=audio_encoder_config.to_dict()  ,			decoder=decoder_config.to_dict()  ,			**A  ,			)
  
  
  
        def 		snake_case_      (  self  :			int		):
             _UpperCAmelCase    :			Optional[int]              =					copy.deepcopy(self.__dict__		)
             _UpperCAmelCase    :			List[Any]              =					self.text_encoder.to_dict()
             _UpperCAmelCase    :			str              =					self.audio_encoder.to_dict()
             _UpperCAmelCase    :			List[str]              =					self.decoder.to_dict()
             _UpperCAmelCase    :			str              =					self.__class__.model_type
             return output
  
style_context: 
  
  
  
  """simple docstring"""
  
  
  
  
  def 		__snake_case		(   SCREAMING_SNAKE_CASE__			:		list       )						->     bool:
  
  
  
  
  
       '''simple docstring'''
  
       if not isinstance(SCREAMING_SNAKE_CASE__		,						SCREAMING_SNAKE_CASE__       ):
            raise ValueError("Input series is not valid, valid series - [1, 2/3, 2]"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 0:
            raise ValueError("Input list must be a non empty list"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 1 and series[0] != 0:
            return True
       _UpperCAmelCase    :			Tuple              =					[]
       _UpperCAmelCase    :			Any              =					len(SCREAMING_SNAKE_CASE__       )
       for i in range(0		,						SCREAMING_SNAKE_CASE__       ):
            if series[i] == 0:
                 raise ValueError("Input series cannot have 0 as an element"       )
            rec_series.append(1 / series[i]       )
       _UpperCAmelCase    :			Dict              =					rec_series[1] - rec_series[0]
       for index in range(2		,						SCREAMING_SNAKE_CASE__       ):
            if rec_series[index] - rec_series[index - 1] != common_diff:
                 return False
       return True
  
  def 		__snake_case		(   SCREAMING_SNAKE_CASE__			:		list       )						->     float:
  
  
  
  
  
       '''simple docstring'''
  
       if not isinstance(SCREAMING_SNAKE_CASE__		,						SCREAMING_SNAKE_CASE__       ):
            raise ValueError("Input series is not valid, valid series - [2, 4, 6]"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 0:
            raise ValueError("Input list must be a non empty list"       )
       _UpperCAmelCase    :			Any              =					0
       for val in series:
            answer += 1 / val
       return len(SCREAMING_SNAKE_CASE__       ) / answer
  
  
  if __name__ == "__main__":
   import doctest
  
   doctest.testmod()
  