






"""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  (		lowercase_       ):





   '''simple docstring'''






   UpperCamelCase__     	=							"""musicgen_decoder"""
   UpperCamelCase__     	=							["""past_key_values"""]





   def __init__(       self					, UpperCAmelCase_=2_048					, UpperCAmelCase_=2_048					, UpperCAmelCase_=24					, UpperCAmelCase_=4_096					, UpperCAmelCase_=16					, UpperCAmelCase_=0.0					, UpperCAmelCase_=True					, UpperCAmelCase_="gelu"					, UpperCAmelCase_=1_024					, UpperCAmelCase_=0.1					, UpperCAmelCase_=0.0					, UpperCAmelCase_=0.0					, UpperCAmelCase_=0.02					, UpperCAmelCase_=False					, UpperCAmelCase_=4					, UpperCAmelCase_=2_048					, UpperCAmelCase_=2_048					, UpperCAmelCase_=None					, UpperCAmelCase_=False					, **UpperCAmelCase_					, )			->   int:




          '''simple docstring'''




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







class 						_a  (		lowercase_       ):





   '''simple docstring'''






   UpperCamelCase__     	=							"""musicgen"""
   UpperCamelCase__     	=							True





   def __init__(       self					, **UpperCAmelCase_)			->   Any:




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

          lowercase__:							Tuple         =     kwargs.pop("text_encoder")
          lowercase__:							List[Any]         =     text_encoder_config.pop("model_type")

          lowercase__:							Optional[int]         =     kwargs.pop("audio_encoder")
          lowercase__:							Dict         =     audio_encoder_config.pop("model_type")

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

          lowercase__:							Tuple         =     AutoConfig.for_model(UpperCAmelCase_					, **UpperCAmelCase_)
          lowercase__:							Tuple         =     AutoConfig.for_model(UpperCAmelCase_					, **UpperCAmelCase_)
          lowercase__:							List[str]         =     MusicgenDecoderConfig(**UpperCAmelCase_)
          lowercase__:							int         =     True





   @classmethod
   def __lowercase							(       cls					, UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_					, **UpperCAmelCase_					, )			->   List[Any]:




          '''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 __lowercase							(       self)			->   str:




          '''simple docstring'''




          lowercase__:							Optional[Any]         =     copy.deepcopy(self.__dict__)
          lowercase__:							Tuple         =     self.text_encoder.to_dict()
          lowercase__:							str         =     self.audio_encoder.to_dict()
          lowercase__:							int         =     self.decoder.to_dict()
          lowercase__:							str         =     self.__class__.model_type
          return output














"""simple docstring"""





import doctest

import projectq
from projectq.ops import H, Measure






def 							A(    snake_case_						):
       """simple docstring"""





       lowercase__:							Dict         =     quantum_engine.allocate_qubit()
       H | qubit
       Measure | qubit
       return int(snake_case_						)


if __name__ == "__main__":
  doctest.testmod()

  # initialises a new quantum backend
  UpperCamelCase					=     projectq.MainEngine()

  # Generate a list of 10 random numbers
  UpperCamelCase					=     [get_random_number(quantum_engine) for _ in range(10)]

  # Flushes the quantum engine from memory
  quantum_engine.flush()

  print("""Random numbers""", random_numbers_list)






