code: 
  
  
  import copy
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  from ..auto.configuration_auto import AutoConfig
  
  
  __snake_case             =	logging.get_logger(__name__)
  
  __snake_case             =	{
      '''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 (_a	):
         _lowercase       							=    """musicgen_decoder"""
         _lowercase       							=    ["""past_key_values"""]
  
  
  
  
  
  
  
         def __init__( self:   Union[str, Any],A_:   str=2048,A_:   str=2048,A_:   List[str]=24,A_:   List[Any]=4096,A_:   Tuple=16,A_:   Optional[Any]=0.0,A_:   Optional[int]=True,A_:   Union[str, Any]="gelu",A_:   str=1024,A_:   Tuple=0.1,A_:   Union[str, Any]=0.0,A_:   List[Any]=0.0,A_:   int=0.0_2,A_:   Optional[Any]=False,A_:   Union[str, Any]=4,A_:   Optional[int]=2048,A_:   Union[str, Any]=2048,A_:   str=None,A_:   Tuple=False,**A_:   Union[str, Any],):
  
  
  
  
  
  
              '''simple docstring'''
  
  
  
  
              __UpperCamelCase   = vocab_size
              __UpperCamelCase   = max_position_embeddings
              __UpperCamelCase   = hidden_size
              __UpperCamelCase   = ffn_dim
              __UpperCamelCase   = num_hidden_layers
              __UpperCamelCase   = num_attention_heads
              __UpperCamelCase   = dropout
              __UpperCamelCase   = attention_dropout
              __UpperCamelCase   = activation_dropout
              __UpperCamelCase   = activation_function
              __UpperCamelCase   = initializer_factor
              __UpperCamelCase   = layerdrop
              __UpperCamelCase   = use_cache
              __UpperCamelCase   = scale_embedding  # scale factor will be sqrt(d_model) if True
              __UpperCamelCase   = num_codebooks
              super().__init__(
                  pad_token_id=A_,bos_token_id=A_,eos_token_id=A_,tie_word_embeddings=A_,**A_,)
  
  
  
  class   __lowerCamelCase (_a	):
         _lowercase       							=    """musicgen"""
         _lowercase       							=    True
  
  
  
  
  
  
  
         def __init__( self:   Tuple,**A_:   Tuple				):
  
  
  
  
  
  
              '''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'				)
  
              __UpperCamelCase   = kwargs.pop('text_encoder'				)
              __UpperCamelCase   = text_encoder_config.pop('model_type'				)
  
              __UpperCamelCase   = kwargs.pop('audio_encoder'				)
              __UpperCamelCase   = audio_encoder_config.pop('model_type'				)
  
              __UpperCamelCase   = kwargs.pop('decoder'				)
  
              __UpperCamelCase   = AutoConfig.for_model(A_,**A_				)
              __UpperCamelCase   = AutoConfig.for_model(A_,**A_				)
              __UpperCamelCase   = MusicgenDecoderConfig(**A_				)
              __UpperCamelCase   = True
  
  
  
  
  
  
  
         @classmethod
         def 		snake_case_  ( cls:   List[Any],A_:   PretrainedConfig,A_:   PretrainedConfig,A_:   MusicgenDecoderConfig,**A_:   Dict,):
  
  
  
  
  
  
              '''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 		snake_case_  ( self:   List[Any]				):
  
  
  
  
  
  
              '''simple docstring'''
  
  
  
  
              __UpperCamelCase   = copy.deepcopy(self.__dict__				)
              __UpperCamelCase   = self.text_encoder.to_dict()
              __UpperCamelCase   = self.audio_encoder.to_dict()
              __UpperCamelCase   = self.decoder.to_dict()
              __UpperCamelCase   = self.__class__.model_type
              return output
  
style_context: 
  
  
  import warnings
  from collections.abc import Callable
  from typing import Any
  
  import numpy
  from matplotlib import pyplot
  
  __snake_case             =	0.25 + 0.0j
  __snake_case             =	-0.4 + 0.6j
  __snake_case             =	-0.1 + 0.6_51j
  __snake_case             =	-2.0
  __snake_case             =	5_6
  __snake_case             =	2.0
  __snake_case             =	6_6_6
  
  
  
  
  
  
  def 		_A		(		_lowercase				,     _lowercase   )				->   numpy.ndarray:
  
  
       """simple docstring"""
  
  
       return numpy.exp(_lowercase   ) + c_parameter
  
  
  
  
  
  
  def 		_A		(		_lowercase				,     _lowercase   )				->   numpy.ndarray:
  
  
       """simple docstring"""
  
  
       return z_values * z_values + c_parameter
  
  
  
  
  
  
  def 		_A		(		_lowercase				,     _lowercase   )				->   numpy.ndarray:
  
  
       """simple docstring"""
  
  
       __UpperCamelCase   = numpy.linspace(-window_size				,     _lowercase				,     _lowercase   )
       __UpperCamelCase   = x.reshape((nb_pixels, 1)   )
       __UpperCamelCase   = numpy.linspace(-window_size				,     _lowercase				,     _lowercase   )
       __UpperCamelCase   = y.reshape((1, nb_pixels)   )
       return x + 1.0J * y
  
  
  
  
  
  
  def 		_A		(		_lowercase				,     _lowercase				,     _lowercase				,     _lowercase				,     _lowercase = None				,     )				->   numpy.ndarray:
  
  
       """simple docstring"""
  
  
       __UpperCamelCase   = z_a.astype('complex64'   )
       for _ in range(_lowercase   ):
            __UpperCamelCase   = eval_function(_lowercase				,     _lowercase   )
            if infinity is not None:
                 numpy.nan_to_num(_lowercase				,     copy=_lowercase				,     nan=_lowercase   )
                 __UpperCamelCase   = infinity
       return z_n
  
  
  
  
  
  
  def 		_A		(		_lowercase				,     _lowercase				,     _lowercase				,     _lowercase				,     )				->   None:
  
  
       """simple docstring"""
  
  
       __UpperCamelCase   = (abs(_lowercase   )).transpose()
       __UpperCamelCase   = abs_z_final[::-1, :]
       pyplot.matshow(abs_z_final < escape_radius   )
       pyplot.title(f'''Julia set of ${function_label}$, $c={function_params}$'''   )
       pyplot.show()
  
  
  
  
  
  
  def 		_A		(		)				->   None:
  
  
       """simple docstring"""
  
  
       warnings.filterwarnings(
           'ignore'				,     category=_lowercase				,     message='overflow encountered in multiply'   )
       warnings.filterwarnings(
           'ignore'				,     category=_lowercase				,     message='invalid value encountered in multiply'				,     )
       warnings.filterwarnings(
           'ignore'				,     category=_lowercase				,     message='overflow encountered in absolute'   )
       warnings.filterwarnings(
           'ignore'				,     category=_lowercase				,     message='overflow encountered in exp'   )
  
  
  if __name__ == "__main__":
      __snake_case             =	prepare_grid(window_size, nb_pixels)
  
      ignore_overflow_warnings()  # See file header for explanations
  
      __snake_case             =	2_4
      __snake_case             =	2 * abs(c_cauliflower) + 1
      __snake_case             =	iterate_function(
          eval_quadratic_polynomial,
          c_cauliflower,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results('''z^2+c''', c_cauliflower, escape_radius, z_final)
  
      __snake_case             =	6_4
      __snake_case             =	2 * abs(c_polynomial_a) + 1
      __snake_case             =	iterate_function(
          eval_quadratic_polynomial,
          c_polynomial_a,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results('''z^2+c''', c_polynomial_a, escape_radius, z_final)
  
      __snake_case             =	1_6_1
      __snake_case             =	2 * abs(c_polynomial_a) + 1
      __snake_case             =	iterate_function(
          eval_quadratic_polynomial,
          c_polynomial_a,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results('''z^2+c''', c_polynomial_a, escape_radius, z_final)
  
      __snake_case             =	1_2
      __snake_case             =	10_000.0
      __snake_case             =	iterate_function(
          eval_exponential,
          c_exponential,
          nb_iterations,
          z_a + 2,
          infinity=1.0e10,
      )
      show_results('''e^z+c''', c_exponential, escape_radius, z_final)
  
  
  