





import copy

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


UpperCAmelCase__    :      Union[str, Any]       					=logging.get_logger(__name__)

UpperCAmelCase__    :      Optional[int]       					={
    '''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    __A  (    a     ):
				__A  =					"""musicgen_decoder"""
				__A  =					["""past_key_values"""]


				def __init__(		self ,			UpperCAmelCase_=2048 ,			UpperCAmelCase_=2048 ,			UpperCAmelCase_=24 ,			UpperCAmelCase_=4096 ,			UpperCAmelCase_=16 ,			UpperCAmelCase_=0.0 ,			UpperCAmelCase_=True ,			UpperCAmelCase_="gelu" ,			UpperCAmelCase_=1024 ,			UpperCAmelCase_=0.1 ,			UpperCAmelCase_=0.0 ,			UpperCAmelCase_=0.0 ,			UpperCAmelCase_=0.0_2 ,			UpperCAmelCase_=False ,			UpperCAmelCase_=4 ,			UpperCAmelCase_=2048 ,			UpperCAmelCase_=2048 ,			UpperCAmelCase_=None ,			UpperCAmelCase_=False ,			**UpperCAmelCase_ ,			):
								lowerCamelCase									=vocab_size
								lowerCamelCase									=max_position_embeddings
								lowerCamelCase									=hidden_size
								lowerCamelCase									=ffn_dim
								lowerCamelCase									=num_hidden_layers
								lowerCamelCase									=num_attention_heads
								lowerCamelCase									=dropout
								lowerCamelCase									=attention_dropout
								lowerCamelCase									=activation_dropout
								lowerCamelCase									=activation_function
								lowerCamelCase									=initializer_factor
								lowerCamelCase									=layerdrop
								lowerCamelCase									=use_cache
								lowerCamelCase									=scale_embedding  # scale factor will be sqrt(d_model) if True
								lowerCamelCase									=num_codebooks
								super().__init__(
								    pad_token_id=UpperCAmelCase_ ,			bos_token_id=UpperCAmelCase_ ,			eos_token_id=UpperCAmelCase_ ,			tie_word_embeddings=UpperCAmelCase_ ,			**UpperCAmelCase_ ,			)




class    __A  (    a     ):
				__A  =					"""musicgen"""
				__A  =					True


				def __init__(		self ,			**UpperCAmelCase_				):
								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"""				)

								lowerCamelCase									=kwargs.pop("""text_encoder"""				)
								lowerCamelCase									=text_encoder_config.pop("""model_type"""				)

								lowerCamelCase									=kwargs.pop("""audio_encoder"""				)
								lowerCamelCase									=audio_encoder_config.pop("""model_type"""				)

								lowerCamelCase									=kwargs.pop("""decoder"""				)

								lowerCamelCase									=AutoConfig.for_model(UpperCAmelCase_ ,			**UpperCAmelCase_				)
								lowerCamelCase									=AutoConfig.for_model(UpperCAmelCase_ ,			**UpperCAmelCase_				)
								lowerCamelCase									=MusicgenDecoderConfig(**UpperCAmelCase_				)
								lowerCamelCase									=True


				@classmethod
				def _snake_case							(		cls ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			**UpperCAmelCase_ ,			):
								return cls(
								    text_encoder=text_encoder_config.to_dict() ,			audio_encoder=audio_encoder_config.to_dict() ,			decoder=decoder_config.to_dict() ,			**UpperCAmelCase_ ,			)


				def _snake_case							(		self				):
								lowerCamelCase									=copy.deepcopy(self.__dict__				)
								lowerCamelCase									=self.text_encoder.to_dict()
								lowerCamelCase									=self.audio_encoder.to_dict()
								lowerCamelCase									=self.decoder.to_dict()
								lowerCamelCase									=self.__class__.model_type
								return output












from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCAmelCase__    :      int       					={
    '''configuration_flaubert''': ['''FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FlaubertConfig''', '''FlaubertOnnxConfig'''],
    '''tokenization_flaubert''': ['''FlaubertTokenizer'''],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__    :      int       					=[
							    '''FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''FlaubertForMultipleChoice''',
							    '''FlaubertForQuestionAnswering''',
							    '''FlaubertForQuestionAnsweringSimple''',
							    '''FlaubertForSequenceClassification''',
							    '''FlaubertForTokenClassification''',
							    '''FlaubertModel''',
							    '''FlaubertWithLMHeadModel''',
							    '''FlaubertPreTrainedModel''',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__    :      List[str]       					=[
							    '''TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''TFFlaubertForMultipleChoice''',
							    '''TFFlaubertForQuestionAnsweringSimple''',
							    '''TFFlaubertForSequenceClassification''',
							    '''TFFlaubertForTokenClassification''',
							    '''TFFlaubertModel''',
							    '''TFFlaubertPreTrainedModel''',
							    '''TFFlaubertWithLMHeadModel''',
							]


if TYPE_CHECKING:
							from .configuration_flaubert import FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, FlaubertConfig, FlaubertOnnxConfig
							from .tokenization_flaubert import FlaubertTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flaubert import (
														    FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FlaubertForMultipleChoice,
														    FlaubertForQuestionAnswering,
														    FlaubertForQuestionAnsweringSimple,
														    FlaubertForSequenceClassification,
														    FlaubertForTokenClassification,
														    FlaubertModel,
														    FlaubertPreTrainedModel,
														    FlaubertWithLMHeadModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_flaubert import (
														    TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFFlaubertForMultipleChoice,
														    TFFlaubertForQuestionAnsweringSimple,
														    TFFlaubertForSequenceClassification,
														    TFFlaubertForTokenClassification,
														    TFFlaubertModel,
														    TFFlaubertPreTrainedModel,
														    TFFlaubertWithLMHeadModel,
														)

else:
							import sys

							UpperCAmelCase__    :      List[Any]       					=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





