


import multiprocessing
import time

from arguments import PretokenizationArguments
from datasets import load_dataset

from transformers import AutoTokenizer, HfArgumentParser
def      snake_case_						( __lowercase     :   Optional[Any]       ):
   UpperCAmelCase_							:      str						=   {}
   UpperCAmelCase_							:      Tuple						=   tokenizer(example['''content''']			,       truncation=__lowercase       )['''input_ids''']
   UpperCAmelCase_							:      Dict						=   len(example['''content''']       ) / len(output['''input_ids''']       )
   return output


__UpperCamelCase				:  str      					=							HfArgumentParser(PretokenizationArguments)
__UpperCamelCase				:  Union[str, Any]      					=							parser.parse_args()
if args.num_workers is None:
       __UpperCamelCase				:  Any      					=							multiprocessing.cpu_count()
__UpperCamelCase				:  Optional[int]      					=							AutoTokenizer.from_pretrained(args.tokenizer_dir)

__UpperCamelCase				:  int      					=							time.time()
__UpperCamelCase				:  Dict      					=							load_dataset(args.dataset_name, split='train')
print(F'Dataset loaded in {time.time()-t_start:.2f}s')

__UpperCamelCase				:  Optional[int]      					=							time.time()
__UpperCamelCase				:  Optional[int]      					=							ds.map(
    tokenize,
    num_proc=args.num_workers,
    remove_columns=[
        'repo_name',
        'path',
        'copies',
        'size',
        'content',
        'license',
        'hash',
        'line_mean',
        'line_max',
        'alpha_frac',
        'autogenerated',
    ],
)
print(F'Dataset tokenized in {time.time()-t_start:.2f}s')

__UpperCamelCase				:  Any      					=							time.time()
ds.push_to_hub(args.tokenized_data_repo)


print(F'Data pushed to the hub in {time.time()-t_start:.2f}s')



import math

import qiskit
def      snake_case_						( __lowercase = 1			,       __lowercase = 1			,       __lowercase = 1       ):
   if (
       isinstance(__lowercase			,       __lowercase       )
       or isinstance(__lowercase			,       __lowercase       )
       or isinstance(__lowercase			,       __lowercase       )
   ):
      raise TypeError('''inputs must be integers.'''       )

   if (input_a < 0) or (input_a < 0) or (carry_in < 0):
      raise ValueError('''inputs must be positive.'''       )

   if (
       (math.floor(__lowercase       ) != input_a)
       or (math.floor(__lowercase       ) != input_a)
       or (math.floor(__lowercase       ) != carry_in)
   ):
      raise ValueError('''inputs must be exact integers.'''       )

   if (input_a > 2) or (input_a > 2) or (carry_in > 2):
      raise ValueError('''inputs must be less or equal to 2.'''       )

   # build registers
   UpperCAmelCase_							:      Any						=   qiskit.QuantumRegister(4			,       '''qr'''       )
   UpperCAmelCase_							:      List[str]						=   qiskit.ClassicalRegister(2			,       '''cr'''       )
   # list the entries
   UpperCAmelCase_							:      Any						=   [input_a, input_a, carry_in]

   UpperCAmelCase_							:      Dict						=   qiskit.QuantumCircuit(__lowercase			,       __lowercase       )

   for i in range(0			,       3       ):
      if entry[i] == 2:
         quantum_circuit.h(__lowercase       )  # for hadamard entries
      elif entry[i] == 1:
         quantum_circuit.x(__lowercase       )  # for 1 entries
      elif entry[i] == 0:
         quantum_circuit.i(__lowercase       )  # for 0 entries

    # build the circuit
   quantum_circuit.ccx(0			,       1			,       3       )  # ccx = toffoli gate
   quantum_circuit.cx(0			,       1       )
   quantum_circuit.ccx(1			,       2			,       3       )
   quantum_circuit.cx(1			,       2       )
   quantum_circuit.cx(0			,       1       )

   quantum_circuit.measure([2, 3]			,       __lowercase       )  # measure the last two qbits

   UpperCAmelCase_							:      Optional[int]						=   qiskit.Aer.get_backend('''aer_simulator'''       )
   UpperCAmelCase_							:      List[str]						=   qiskit.execute(__lowercase			,       __lowercase			,       shots=1_0_0_0       )

   return job.result().get_counts(__lowercase       )


if __name__ == "__main__":
       print(F'Total sum count for state is: {quantum_full_adder(1, 1, 1)}')