code: 
  
  
  
  
  
  import copy
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  from ..auto.configuration_auto import AutoConfig
  
  
  _lowercase		:     List[str] 					=logging.get_logger(__name__)
  
  _lowercase		:     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_     (     snake_case__       ):
  					_a			:	Optional[Any]							=				'musicgen_decoder'
  					_a			:	Any							=				['past_key_values']
  
  
  
  					def __init__(		self    :    Tuple					,			lowerCamelCase    :    int=20_48					,			lowerCamelCase    :    Dict=20_48					,			lowerCamelCase    :    Any=24					,			lowerCamelCase    :    List[Any]=40_96					,			lowerCamelCase    :    Union[str, Any]=16					,			lowerCamelCase    :    int=0.0					,			lowerCamelCase    :    Any=True					,			lowerCamelCase    :    Optional[Any]="gelu"					,			lowerCamelCase    :    Dict=10_24					,			lowerCamelCase    :    Optional[int]=0.1					,			lowerCamelCase    :    Union[str, Any]=0.0					,			lowerCamelCase    :    List[str]=0.0					,			lowerCamelCase    :    Optional[int]=0.02					,			lowerCamelCase    :    str=False					,			lowerCamelCase    :    int=4					,			lowerCamelCase    :    List[Any]=20_48					,			lowerCamelCase    :    int=20_48					,			lowerCamelCase    :    Optional[Any]=None					,			lowerCamelCase    :    int=False					,			**lowerCamelCase    :    Tuple					,			):
  							lowerCamelCase_  :    List[Any]   	=			vocab_size
  							lowerCamelCase_  :    str   	=			max_position_embeddings
  							lowerCamelCase_  :    Optional[Any]   	=			hidden_size
  							lowerCamelCase_  :    str   	=			ffn_dim
  							lowerCamelCase_  :    int   	=			num_hidden_layers
  							lowerCamelCase_  :    Union[str, Any]   	=			num_attention_heads
  							lowerCamelCase_  :    List[str]   	=			dropout
  							lowerCamelCase_  :    List[str]   	=			attention_dropout
  							lowerCamelCase_  :    Optional[int]   	=			activation_dropout
  							lowerCamelCase_  :    Dict   	=			activation_function
  							lowerCamelCase_  :    Optional[int]   	=			initializer_factor
  							lowerCamelCase_  :    Union[str, Any]   	=			layerdrop
  							lowerCamelCase_  :    List[Any]   	=			use_cache
  							lowerCamelCase_  :    List[Any]   	=			scale_embedding  # scale factor will be sqrt(d_model) if True
  							lowerCamelCase_  :    List[str]   	=			num_codebooks
  							super().__init__(
  							    pad_token_id=lowerCamelCase					,			bos_token_id=lowerCamelCase					,			eos_token_id=lowerCamelCase					,			tie_word_embeddings=lowerCamelCase					,			**lowerCamelCase					,			)
  
  
  
  
  
  
  class 	UpperCamelCase_     (     snake_case__       ):
  					_a			:	Tuple							=				'musicgen'
  					_a			:	int							=				True
  
  
  
  					def __init__(		self    :    Tuple					,			**lowerCamelCase    :    Union[str, Any]	):
  							super().__init__(**lowerCamelCase	)
  							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'	)
  
  							lowerCamelCase_  :    List[Any]   	=			kwargs.pop('text_encoder'	)
  							lowerCamelCase_  :    Any   	=			text_encoder_config.pop('model_type'	)
  
  							lowerCamelCase_  :    Optional[int]   	=			kwargs.pop('audio_encoder'	)
  							lowerCamelCase_  :    str   	=			audio_encoder_config.pop('model_type'	)
  
  							lowerCamelCase_  :    List[str]   	=			kwargs.pop('decoder'	)
  
  							lowerCamelCase_  :    int   	=			AutoConfig.for_model(lowerCamelCase					,			**lowerCamelCase	)
  							lowerCamelCase_  :    Dict   	=			AutoConfig.for_model(lowerCamelCase					,			**lowerCamelCase	)
  							lowerCamelCase_  :    Dict   	=			MusicgenDecoderConfig(**lowerCamelCase	)
  							lowerCamelCase_  :    Optional[Any]   	=			True
  
  
  
  					@classmethod
  					def      __a    (		cls    :    Optional[int]					,			lowerCamelCase    :    PretrainedConfig					,			lowerCamelCase    :    PretrainedConfig					,			lowerCamelCase    :    MusicgenDecoderConfig					,			**lowerCamelCase    :    Union[str, Any]					,			):
  							return cls(
  							    text_encoder=text_encoder_config.to_dict()					,			audio_encoder=audio_encoder_config.to_dict()					,			decoder=decoder_config.to_dict()					,			**lowerCamelCase					,			)
  
  
  
  
  
  					def      __a    (		self    :    List[str]	):
  							lowerCamelCase_  :    Tuple   	=			copy.deepcopy(self.__dict__	)
  							lowerCamelCase_  :    List[Any]   	=			self.text_encoder.to_dict()
  							lowerCamelCase_  :    Union[str, Any]   	=			self.audio_encoder.to_dict()
  							lowerCamelCase_  :    Any   	=			self.decoder.to_dict()
  							lowerCamelCase_  :    Any   	=			self.__class__.model_type
  							return output
  
style_context: 
  
  
  
  
  
  from __future__ import annotations
  
  
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__	):
  		lowerCamelCase_  :    int
  		lowerCamelCase_  :    list[str]   	=			list(lowerCAmelCase__	)
  		lowerCamelCase_	,			lowerCamelCase_  :    List[str]   	=			_vector[:-1], int(_vector[-1]	)
  		lowerCamelCase_  :    list[int]   	=			[int(lowerCAmelCase__	) for digit in __vector]
  
  		vector.reverse()
  		for i, digit in enumerate(lowerCAmelCase__	):
  				if i & 1 == 0:
  						lowerCamelCase_  :    int   	=			digit * 2
  						if doubled > 9:
  								doubled -= 9
  						check_digit += doubled
  				else:
  						check_digit += digit
  
  		return check_digit % 10 == 0
  
  
  if __name__ == "__main__":
  		import doctest
  
  		doctest.testmod()
  		assert is_luhn("""79927398713""")
  		assert not is_luhn("""79927398714""")
  