




from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase_						=logging.get_logger(__name__)

UpperCAmelCase_						={
    """s-JoL/Open-Llama-V1""": """https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json""",
}


class 							__UpperCamelCase			( __UpperCAmelCase  ):





				'''simple docstring'''



				__a							: Optional[int]										="""open-llama"""



				def __init__( self       , UpperCAmelCase_=10_00_00       , UpperCAmelCase_=40_96       , UpperCAmelCase_=1_10_08       , UpperCAmelCase_=32       , UpperCAmelCase_=32       , UpperCAmelCase_="silu"       , UpperCAmelCase_=20_48       , UpperCAmelCase_=0.02       , UpperCAmelCase_=1E-6       , UpperCAmelCase_=True       , UpperCAmelCase_=0       , UpperCAmelCase_=1       , UpperCAmelCase_=2       , UpperCAmelCase_=False       , UpperCAmelCase_=True       , UpperCAmelCase_=0.1       , UpperCAmelCase_=0.1       , UpperCAmelCase_=True       , UpperCAmelCase_=True       , UpperCAmelCase_=None       , **UpperCAmelCase_       , ):
											lowerCAmelCase   =		vocab_size
											lowerCAmelCase   =		max_position_embeddings
											lowerCAmelCase   =		hidden_size
											lowerCAmelCase   =		intermediate_size
											lowerCAmelCase   =		num_hidden_layers
											lowerCAmelCase   =		num_attention_heads
											lowerCAmelCase   =		hidden_act
											lowerCAmelCase   =		initializer_range
											lowerCAmelCase   =		rms_norm_eps
											lowerCAmelCase   =		use_cache
											lowerCAmelCase   =		kwargs.pop(
											    '''use_memorry_efficient_attention'''       , __A						)
											lowerCAmelCase   =		hidden_dropout_prob
											lowerCAmelCase   =		attention_dropout_prob
											lowerCAmelCase   =		use_stable_embedding
											lowerCAmelCase   =		shared_input_output_embedding
											lowerCAmelCase   =		rope_scaling
											self._rope_scaling_validation()

											super().__init__(
											    pad_token_id=__A       , bos_token_id=__A       , eos_token_id=__A       , tie_word_embeddings=__A       , **__A       , )






				def       __snake_case		( self						):
											if self.rope_scaling is None:
																		return

											if not isinstance(self.rope_scaling       , __A						) or len(self.rope_scaling						) != 2:
																		raise ValueError(
																		    '''`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, '''
																		    F"""got {self.rope_scaling}"""						)
											lowerCAmelCase   =		self.rope_scaling.get('''type'''       , __A						)
											lowerCAmelCase   =		self.rope_scaling.get('''factor'''       , __A						)
											if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
																		raise ValueError(
																		    F"""`rope_scaling`'s name field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"""						)
											if rope_scaling_factor is None or not isinstance(__A       , __A						) or rope_scaling_factor <= 1.0:
																		raise ValueError(F"""`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}"""						)









import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute



def       UpperCAmelCase       (     _snake_case = 3							):
							if isinstance(_snake_case						, _snake_case							):
														raise TypeError('''number of qubits must be a integer.'''							)
							if number_of_qubits <= 0:
														raise ValueError('''number of qubits must be > 0.'''							)
							if math.floor(_snake_case							) != number_of_qubits:
														raise ValueError('''number of qubits must be exact integer.'''							)
							if number_of_qubits > 10:
														raise ValueError('''number of qubits too large to simulate(>10).'''							)

							lowerCAmelCase   =		QuantumRegister(_snake_case						, '''qr'''							)
							lowerCAmelCase   =		ClassicalRegister(_snake_case						, '''cr'''							)

							lowerCAmelCase   =		QuantumCircuit(_snake_case						, _snake_case							)

							lowerCAmelCase   =		number_of_qubits

							for i in range(_snake_case							):
														quantum_circuit.h(number_of_qubits - i - 1							)
														counter -= 1
														for j in range(_snake_case							):
																					quantum_circuit.cp(np.pi / 2 ** (counter - j)						, _snake_case						, _snake_case							)

							for k in range(number_of_qubits // 2							):
														quantum_circuit.swap(_snake_case						, number_of_qubits - k - 1							)

							# measure all the qubits
							quantum_circuit.measure(_snake_case						, _snake_case							)
							# simulate with 10000 shots
							lowerCAmelCase   =		Aer.get_backend('''qasm_simulator'''							)
							lowerCAmelCase   =		execute(_snake_case						, _snake_case						, shots=10000							)

							return job.result().get_counts(_snake_case							)


if __name__ == "__main__":
		print(
		    F'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
		)



