
'''simple docstring'''
import copy

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


a_           =    logging.get_logger(__name__)

a_           =    {
    "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__       ):
 UpperCAmelCase_		     =    """musicgen_decoder"""
 UpperCAmelCase_		     =    ["""past_key_values"""]





 def __init__(     self			,							lowercase_=20_48			,							lowercase_=20_48			,							lowercase_=24			,							lowercase_=40_96			,							lowercase_=16			,							lowercase_=0.0			,							lowercase_=True			,							lowercase_="gelu"			,							lowercase_=10_24			,							lowercase_=0.1			,							lowercase_=0.0			,							lowercase_=0.0			,							lowercase_=0.02			,							lowercase_=False			,							lowercase_=4			,							lowercase_=20_48			,							lowercase_=20_48			,							lowercase_=None			,							lowercase_=False			,							**lowercase_			,							):
     snake_case_			:     Dict        =    vocab_size
     snake_case_			:     Dict        =    max_position_embeddings
     snake_case_			:     Dict        =    hidden_size
     snake_case_			:     str        =    ffn_dim
     snake_case_			:     str        =    num_hidden_layers
     snake_case_			:     List[Any]        =    num_attention_heads
     snake_case_			:     List[Any]        =    dropout
     snake_case_			:     str        =    attention_dropout
     snake_case_			:     Optional[Any]        =    activation_dropout
     snake_case_			:     Union[str, Any]        =    activation_function
     snake_case_			:     List[str]        =    initializer_factor
     snake_case_			:     List[str]        =    layerdrop
     snake_case_			:     Dict        =    use_cache
     snake_case_			:     Optional[int]        =    scale_embedding  # scale factor will be sqrt(d_model) if True
     snake_case_			:     Optional[Any]        =    num_codebooks
     super().__init__(
         pad_token_id=lowercase_			,							bos_token_id=lowercase_			,							eos_token_id=lowercase_			,							tie_word_embeddings=lowercase_			,							**lowercase_			,							)






class  UpperCAmelCase_					(						snake_case__       ):
 UpperCAmelCase_		     =    """musicgen"""
 UpperCAmelCase_		     =    True





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

     snake_case_			:     List[Any]        =    kwargs.pop("text_encoder")
     snake_case_			:     str        =    text_encoder_config.pop("model_type")

     snake_case_			:     str        =    kwargs.pop("audio_encoder")
     snake_case_			:     List[str]        =    audio_encoder_config.pop("model_type")

     snake_case_			:     List[str]        =    kwargs.pop("decoder")

     snake_case_			:     List[Any]        =    AutoConfig.for_model(lowercase_			,							**lowercase_)
     snake_case_			:     List[str]        =    AutoConfig.for_model(lowercase_			,							**lowercase_)
     snake_case_			:     List[str]        =    MusicgenDecoderConfig(**lowercase_)
     snake_case_			:     int        =    True





 @classmethod
 def 							snake_case__		(     cls			,							lowercase_			,							lowercase_			,							lowercase_			,							**lowercase_			,							):
     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):
     snake_case_			:     int        =    copy.deepcopy(self.__dict__)
     snake_case_			:     Any        =    self.text_encoder.to_dict()
     snake_case_			:     Optional[Any]        =    self.audio_encoder.to_dict()
     snake_case_			:     Tuple        =    self.decoder.to_dict()
     snake_case_			:     Optional[Any]        =    self.__class__.model_type
     return output






'''simple docstring'''
def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if number != int(__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if number < 0:
        raise ValueError("factorial() not defined for negative values"							)
    snake_case_			:     int        =    1
    for i in range(1,		number + 1							):
        value *= i
    return value

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if not isinstance(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if n < 0:
        raise ValueError("factorial() not defined for negative values"							)
    return 1 if n == 0 or n == 1 else n * factorial(n - 1							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  a_           =    int(input("Enter a positive integer: ").strip() or 0)
  print(f"""factorial{n} is {factorial(n)}""")




