
import copy

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


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

__magic_name__  :  Union[str, Any]     			=   {
    '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       (		__snake_case					):



  """simple docstring"""





  lowerCAmelCase_								=		"""musicgen_decoder"""
  lowerCAmelCase_								=		["""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.02						,    __UpperCamelCase=False						,    __UpperCamelCase=4						,    __UpperCamelCase=2048						,    __UpperCamelCase=2048						,    __UpperCamelCase=None						,    __UpperCamelCase=False						,    **__UpperCamelCase						,    ):
      A_								=					vocab_size
      A_								=					max_position_embeddings
      A_								=					hidden_size
      A_								=					ffn_dim
      A_								=					num_hidden_layers
      A_								=					num_attention_heads
      A_								=					dropout
      A_								=					attention_dropout
      A_								=					activation_dropout
      A_								=					activation_function
      A_								=					initializer_factor
      A_								=					layerdrop
      A_								=					use_cache
      A_								=					scale_embedding  # scale factor will be sqrt(d_model) if True
      A_								=					num_codebooks
      super().__init__(
          pad_token_id=__UpperCamelCase						,    bos_token_id=__UpperCamelCase						,    eos_token_id=__UpperCamelCase						,    tie_word_embeddings=__UpperCamelCase						,    **__UpperCamelCase						,    )



class 							lowerCamelCase       (		__snake_case					):



  """simple docstring"""





  lowerCAmelCase_								=		"""musicgen"""
  lowerCAmelCase_								=		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"					)

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

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

      A_								=					kwargs.pop("decoder"					)

      A_								=					AutoConfig.for_model(__UpperCamelCase						,    **__UpperCamelCase					)
      A_								=					AutoConfig.for_model(__UpperCamelCase						,    **__UpperCamelCase					)
      A_								=					MusicgenDecoderConfig(**__UpperCamelCase					)
      A_								=					True

  @classmethod
  def 					lowercase_						(					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 					lowercase_						(					self					):
      A_								=					copy.deepcopy(self.__dict__					)
      A_								=					self.text_encoder.to_dict()
      A_								=					self.audio_encoder.to_dict()
      A_								=					self.decoder.to_dict()
      A_								=					self.__class__.model_type
      return output








import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def        lowerCAmelCase       (				snake_case__   :      int = 1				,					snake_case__   :      int = 1 )->			qiskit.result.counts.Counts:
    if isinstance(snake_case__				,					snake_case__ ) or isinstance(snake_case__				,					snake_case__ ):
        raise TypeError("inputs must be integers." )
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError("inputs must be positive." )
    if (math.floor(snake_case__ ) != bit_a) or (math.floor(snake_case__ ) != bit_a):
        raise ValueError("inputs must be exact integers." )
    if (bit_a > 1) or (bit_a > 1):
        raise ValueError("inputs must be less or equal to 1." )

    # build registers
    A_								=					QuantumRegister(2				,					"qr" )
    A_								=					ClassicalRegister(2				,					"cr" )

    A_								=					QuantumCircuit(snake_case__				,					snake_case__ )

    # entanglement the qubits
    quantum_circuit.h(1 )
    quantum_circuit.cx(1				,					0 )

    # send the information
    A_								=					str(snake_case__ ) + str(snake_case__ )

    if c_information == "11":
        quantum_circuit.x(1 )
        quantum_circuit.z(1 )
    elif c_information == "10":
        quantum_circuit.z(1 )
    elif c_information == "01":
        quantum_circuit.x(1 )
    else:
        quantum_circuit.i(1 )

    # unentangled the circuit
    quantum_circuit.cx(1				,					0 )
    quantum_circuit.h(1 )

    # measure the circuit
    quantum_circuit.measure(snake_case__				,					snake_case__ )

    A_								=					Aer.get_backend("aer_simulator" )
    A_								=					execute(snake_case__				,					snake_case__				,					shots=1000 )

    return job.result().get_counts(snake_case__ )


if __name__ == "__main__":
     print(f"""Counts for classical state send: {superdense_coding(1,1)}""")






