
def       a			(   a  )    ->list:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE    	=   len(a  )

			# Set the gap value to be decreased by a factor of 1.3
			# after each iteration
			SCREAMING_SNAKE_CASE    	=   1.3

			# Continue sorting until the gap is 1
			while gap > 1:
						# Decrease the gap value
						SCREAMING_SNAKE_CASE    	=   int(gap / shrink  )

						# Sort the elements using insertion sort
						for i in range(a		,	len(a  )  ):
									SCREAMING_SNAKE_CASE    	=   collection[i]
									SCREAMING_SNAKE_CASE    	=   i
									while j >= gap and collection[j - gap] > temp:
												SCREAMING_SNAKE_CASE    	=   collection[j - gap]
												j -= gap
									SCREAMING_SNAKE_CASE    	=   temp

			return collection


if __name__ == "__main__":
							import doctest

							doctest.testmod()

import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


__lowerCAmelCase				      =					logging.get_logger(__name__)

__lowerCAmelCase				      =					{
    '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 						lowerCamelCase			(					__lowerCamelCase				):
	UpperCamelCase_     :				int								=  'musicgen_decoder'
	UpperCamelCase_     :				Optional[int]								=  ['past_key_values']







	def __init__(    self			:List[str]      ,    lowercase			:Tuple=2_0_4_8      ,    lowercase			:Dict=2_0_4_8      ,    lowercase			:Tuple=2_4      ,    lowercase			:Any=4_0_9_6      ,    lowercase			:Optional[Any]=1_6      ,    lowercase			:List[Any]=0.0      ,    lowercase			:Union[str, Any]=True      ,    lowercase			:Optional[Any]="gelu"      ,    lowercase			:Any=1_0_2_4      ,    lowercase			:str=0.1      ,    lowercase			:List[Any]=0.0      ,    lowercase			:List[Any]=0.0      ,    lowercase			:List[Any]=0.02      ,    lowercase			:Optional[int]=False      ,    lowercase			:List[Any]=4      ,    lowercase			:Any=2_0_4_8      ,    lowercase			:Any=2_0_4_8      ,    lowercase			:Optional[int]=None      ,    lowercase			:Tuple=False      ,    **lowercase			:List[Any]      ,    )		->			Tuple:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE    	=   vocab_size
				SCREAMING_SNAKE_CASE    	=   max_position_embeddings
				SCREAMING_SNAKE_CASE    	=   hidden_size
				SCREAMING_SNAKE_CASE    	=   ffn_dim
				SCREAMING_SNAKE_CASE    	=   num_hidden_layers
				SCREAMING_SNAKE_CASE    	=   num_attention_heads
				SCREAMING_SNAKE_CASE    	=   dropout
				SCREAMING_SNAKE_CASE    	=   attention_dropout
				SCREAMING_SNAKE_CASE    	=   activation_dropout
				SCREAMING_SNAKE_CASE    	=   activation_function
				SCREAMING_SNAKE_CASE    	=   initializer_factor
				SCREAMING_SNAKE_CASE    	=   layerdrop
				SCREAMING_SNAKE_CASE    	=   use_cache
				SCREAMING_SNAKE_CASE    	=   scale_embedding  # scale factor will be sqrt(d_model) if True
				SCREAMING_SNAKE_CASE    	=   num_codebooks
				super().__init__(
				    pad_token_id=lowercase      ,    bos_token_id=lowercase      ,    eos_token_id=lowercase      ,    tie_word_embeddings=lowercase      ,    **lowercase      ,    )





class 						lowerCamelCase			(					__lowerCamelCase				):
	UpperCamelCase_     :				str								=  'musicgen'
	UpperCamelCase_     :				Union[str, Any]								=  True







	def __init__(    self			:str      ,    **lowercase			:int )		->			Optional[Any]:







				"""simple docstring"""






				super().__init__(**lowercase )
				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''' )

				SCREAMING_SNAKE_CASE    	=   kwargs.pop('''text_encoder''' )
				SCREAMING_SNAKE_CASE    	=   text_encoder_config.pop('''model_type''' )

				SCREAMING_SNAKE_CASE    	=   kwargs.pop('''audio_encoder''' )
				SCREAMING_SNAKE_CASE    	=   audio_encoder_config.pop('''model_type''' )

				SCREAMING_SNAKE_CASE    	=   kwargs.pop('''decoder''' )

				SCREAMING_SNAKE_CASE    	=   AutoConfig.for_model(lowercase      ,    **lowercase )
				SCREAMING_SNAKE_CASE    	=   AutoConfig.for_model(lowercase      ,    **lowercase )
				SCREAMING_SNAKE_CASE    	=   MusicgenDecoderConfig(**lowercase )
				SCREAMING_SNAKE_CASE    	=   True







	@classmethod
	def    snake_case__    (    cls			:Tuple      ,    lowercase			:PretrainedConfig      ,    lowercase			:PretrainedConfig      ,    lowercase			:MusicgenDecoderConfig      ,    **lowercase			:Tuple      ,    )		->			Tuple:







				"""simple docstring"""






				return cls(
				    text_encoder=text_encoder_config.to_dict()      ,    audio_encoder=audio_encoder_config.to_dict()      ,    decoder=decoder_config.to_dict()      ,    **lowercase      ,    )







	def    snake_case__    (    self			:Dict )		->			Dict:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE    	=   copy.deepcopy(self.__dict__ )
				SCREAMING_SNAKE_CASE    	=   self.text_encoder.to_dict()
				SCREAMING_SNAKE_CASE    	=   self.audio_encoder.to_dict()
				SCREAMING_SNAKE_CASE    	=   self.decoder.to_dict()
				SCREAMING_SNAKE_CASE    	=   self.__class__.model_type
				return output