


def 	_lowerCamelCase  (		A_  :	int      )			->			bool:

   '''simple docstring'''






   if not isinstance(A_							,  A_      ):
      UpperCamelCase__ :			Optional[Any] 						=f'''Input value of [number={number}] must be an integer'''
      raise TypeError(A_      )
   if number < 0 or number % 2 == 1:
      return False
   UpperCamelCase__ :			List[Any] 						=int(number**0.5      )
   return number == number_sqrt * (number_sqrt + 1)


if __name__ == "__main__":
     import doctest

     doctest.testmod()





from arguments import TokenizerTrainingArguments
from datasets import load_dataset
from tqdm import tqdm

from transformers import AutoTokenizer, HfArgumentParser
from transformers.models.gpta.tokenization_gpta import bytes_to_unicode
def 	_lowerCamelCase  (		A_  :	List[Any]=1_0      )			->			List[str]:

   '''simple docstring'''






   for _ in tqdm(range(0							,  args.n_examples							,  A_      )      ):
      yield [next(A_      )[args.text_column] for _ in range(A_      )]


# Configuration
__UpperCAmelCase      			=  HfArgumentParser(TokenizerTrainingArguments)
__UpperCAmelCase      			=  parser.parse_args()

# Base tokenizer
__UpperCAmelCase      			=  AutoTokenizer.from_pretrained(args.base_tokenizer)
__UpperCAmelCase      			=  list(bytes_to_unicode().values())

# Load dataset
__UpperCAmelCase      			=  load_dataset(args.dataset_name, split="""train""", streaming=True)
__UpperCAmelCase      			=  iter(dataset)


# Training and saving
__UpperCAmelCase      			=  tokenizer.train_new_from_iterator(
    batch_iterator(), vocab_size=args.vocab_size, initial_alphabet=base_vocab
)
new_tokenizer.save_pretrained(args.tokenizer_name, push_to_hub=args.push_to_hub)

