






from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase__			 =	logging.get_logger(__name__)

UpperCAmelCase__			 =	{
    '''dandelin/vilt-b32-mlm''': '''https://huggingface.co/dandelin/vilt-b32-mlm/blob/main/config.json'''
}




class        snake_case_					(						__UpperCamelCase			):

						"""simple docstring"""



						snake_case__   					=			"""vilt"""



						def __init__(self:				List[str]   ,				__UpperCAmelCase:				List[Any]=30522   ,				__UpperCAmelCase:				Dict=2   ,				__UpperCAmelCase:				Tuple=2   ,				__UpperCAmelCase:				Optional[int]=40   ,				__UpperCAmelCase:				Tuple=768   ,				__UpperCAmelCase:				Optional[Any]=12   ,				__UpperCAmelCase:				List[str]=12   ,				__UpperCAmelCase:				Optional[int]=3072   ,				__UpperCAmelCase:				Tuple="gelu"   ,				__UpperCAmelCase:				str=0.0   ,				__UpperCAmelCase:				int=0.0   ,				__UpperCAmelCase:				Union[str, Any]=0.02   ,				__UpperCAmelCase:				Dict=1E-12   ,				__UpperCAmelCase:				List[str]=384   ,				__UpperCAmelCase:				Union[str, Any]=32   ,				__UpperCAmelCase:				Any=3   ,				__UpperCAmelCase:				Optional[Any]=True   ,				__UpperCAmelCase:				int=-1   ,				__UpperCAmelCase:				str=False   ,				__UpperCAmelCase:				List[str]=-1   ,				**__UpperCAmelCase:				Tuple   ,				)						->    Dict:




											'''simple docstring'''



											super().__init__(tie_word_embeddings=__UpperCAmelCase   ,				**__UpperCAmelCase      )

											__a				:	List[str]			=				vocab_size
											__a				:	List[Any]			=				type_vocab_size
											__a				:	Union[str, Any]			=				modality_type_vocab_size
											__a				:	Any			=				max_position_embeddings

											__a				:	int			=				hidden_size
											__a				:	Optional[int]			=				num_hidden_layers
											__a				:	List[str]			=				num_attention_heads
											__a				:	int			=				intermediate_size
											__a				:	Any			=				hidden_act
											__a				:	Tuple			=				hidden_dropout_prob
											__a				:	List[Any]			=				attention_probs_dropout_prob
											__a				:	Dict			=				initializer_range
											__a				:	Tuple			=				layer_norm_eps

											__a				:	Tuple			=				image_size
											__a				:	List[str]			=				patch_size
											__a				:	Tuple			=				num_channels
											__a				:	List[Any]			=				qkv_bias
											__a				:	Optional[Any]			=				max_image_length
											__a				:	int			=				num_images













import copy

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


UpperCAmelCase__			 =	logging.get_logger(__name__)

UpperCAmelCase__			 =	{
    '''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        snake_case_					(						__UpperCamelCase			):

						"""simple docstring"""



						snake_case__   					=			"""musicgen_decoder"""
						snake_case__   					=			["""past_key_values"""]



						def __init__(self:				str   ,				__UpperCAmelCase:				Union[str, Any]=2048   ,				__UpperCAmelCase:				Union[str, Any]=2048   ,				__UpperCAmelCase:				List[Any]=24   ,				__UpperCAmelCase:				Dict=4096   ,				__UpperCAmelCase:				int=16   ,				__UpperCAmelCase:				Dict=0.0   ,				__UpperCAmelCase:				str=True   ,				__UpperCAmelCase:				Tuple="gelu"   ,				__UpperCAmelCase:				Optional[Any]=1024   ,				__UpperCAmelCase:				Optional[Any]=0.1   ,				__UpperCAmelCase:				List[Any]=0.0   ,				__UpperCAmelCase:				int=0.0   ,				__UpperCAmelCase:				List[Any]=0.02   ,				__UpperCAmelCase:				Union[str, Any]=False   ,				__UpperCAmelCase:				Any=4   ,				__UpperCAmelCase:				Tuple=2048   ,				__UpperCAmelCase:				Tuple=2048   ,				__UpperCAmelCase:				Dict=None   ,				__UpperCAmelCase:				Dict=False   ,				**__UpperCAmelCase:				Any   ,				)						->    Optional[Any]:




											'''simple docstring'''



											__a				:	Dict			=				vocab_size
											__a				:	List[str]			=				max_position_embeddings
											__a				:	int			=				hidden_size
											__a				:	Union[str, Any]			=				ffn_dim
											__a				:	List[Any]			=				num_hidden_layers
											__a				:	List[Any]			=				num_attention_heads
											__a				:	List[Any]			=				dropout
											__a				:	str			=				attention_dropout
											__a				:	Union[str, Any]			=				activation_dropout
											__a				:	Optional[int]			=				activation_function
											__a				:	List[str]			=				initializer_factor
											__a				:	Union[str, Any]			=				layerdrop
											__a				:	Optional[int]			=				use_cache
											__a				:	List[Any]			=				scale_embedding  # scale factor will be sqrt(d_model) if True
											__a				:	str			=				num_codebooks
											super().__init__(
											    pad_token_id=__UpperCAmelCase   ,				bos_token_id=__UpperCAmelCase   ,				eos_token_id=__UpperCAmelCase   ,				tie_word_embeddings=__UpperCAmelCase   ,				**__UpperCAmelCase   ,				)




class        snake_case_					(						__UpperCamelCase			):

						"""simple docstring"""



						snake_case__   					=			"""musicgen"""
						snake_case__   					=			True



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




											'''simple docstring'''



											super().__init__(**__UpperCAmelCase      )
											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"      )

											__a				:	List[Any]			=				kwargs.pop("text_encoder"      )
											__a				:	Optional[Any]			=				text_encoder_config.pop("model_type"      )

											__a				:	Union[str, Any]			=				kwargs.pop("audio_encoder"      )
											__a				:	Dict			=				audio_encoder_config.pop("model_type"      )

											__a				:	Optional[Any]			=				kwargs.pop("decoder"      )

											__a				:	Optional[int]			=				AutoConfig.for_model(__UpperCAmelCase   ,				**__UpperCAmelCase      )
											__a				:	int			=				AutoConfig.for_model(__UpperCAmelCase   ,				**__UpperCAmelCase      )
											__a				:	List[Any]			=				MusicgenDecoderConfig(**__UpperCAmelCase      )
											__a				:	Optional[int]			=				True



						@classmethod
						def 					UpperCAmelCase__				(cls:				Union[str, Any]   ,				__UpperCAmelCase:				PretrainedConfig   ,				__UpperCAmelCase:				PretrainedConfig   ,				__UpperCAmelCase:				MusicgenDecoderConfig   ,				**__UpperCAmelCase:				Any   ,				)						->    Tuple:




											'''simple docstring'''



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



						def 					UpperCAmelCase__				(self:				List[str]      )						->    int:




											'''simple docstring'''



											__a				:	Dict			=				copy.deepcopy(self.__dict__      )
											__a				:	Optional[Any]			=				self.text_encoder.to_dict()
											__a				:	Optional[Any]			=				self.audio_encoder.to_dict()
											__a				:	Tuple			=				self.decoder.to_dict()
											__a				:	List[Any]			=				self.__class__.model_type
											return output





