'''simple docstring'''




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 					a__   (     UpperCAmelCase__				):
     lowerCamelCase						:  Union[str, Any]							="musicgen_decoder"
     lowerCamelCase						:  List[Any]							=["past_key_values"]






     def __init__(				self	:	List[str]						,       a	:	Dict=20_48						,       a	:	Any=20_48						,       a	:	int=24						,       a	:	Optional[Any]=40_96						,       a	:	Tuple=16						,       a	:	Optional[int]=0.0						,       a	:	Tuple=True						,       a	:	Dict="gelu"						,       a	:	Optional[Any]=10_24						,       a	:	Optional[Any]=0.1						,       a	:	Tuple=0.0						,       a	:	Optional[int]=0.0						,       a	:	Any=0.02						,       a	:	str=False						,       a	:	List[Any]=4						,       a	:	List[str]=20_48						,       a	:	Any=20_48						,       a	:	Dict=None						,       a	:	str=False						,       **a	:	Tuple						,       ):





         """simple docstring"""



         __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=a						,       bos_token_id=a						,       eos_token_id=a						,       tie_word_embeddings=a						,       **a						,       )




class 					a__   (     UpperCAmelCase__				):
     lowerCamelCase						:  Any							="musicgen"
     lowerCamelCase						:  str							=True






     def __init__(				self	:	str						,       **a	:	int					):





         """simple docstring"""



         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'''					)

         __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(a						,       **a					)
         __lowerCamelCase						=						AutoConfig.for_model(a						,       **a					)
         __lowerCamelCase						=						MusicgenDecoderConfig(**a					)
         __lowerCamelCase						=						True






     @classmethod
     def      SCREAMING_SNAKE_CASE__     (				cls	:	Dict						,       a	:	PretrainedConfig						,       a	:	PretrainedConfig						,       a	:	MusicgenDecoderConfig						,       **a	:	str						,       ):





         """simple docstring"""



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






     def      SCREAMING_SNAKE_CASE__     (				self	:	List[Any]					):





         """simple docstring"""



         __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

'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__UpperCAmelCase  							={
    "configuration_rwkv": ["RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP", "RwkvConfig", "RwkvOnnxConfig"],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase  							=[
      "RWKV_PRETRAINED_MODEL_ARCHIVE_LIST",
      "RwkvForCausalLM",
      "RwkvModel",
      "RwkvPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_rwkv import RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP, RwkvConfig, RwkvOnnxConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_rwkv import (
        RWKV_PRETRAINED_MODEL_ARCHIVE_LIST,
        RwkvForCausalLM,
        RwkvModel,
        RwkvPreTrainedModel,
    )
else:
  import sys

  __UpperCAmelCase  							=_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
