





"""simple docstring"""
import multiprocessing
import time

from arguments import PretokenizationArguments
from datasets import load_dataset

from transformers import AutoTokenizer, HfArgumentParser



def 					__lowerCamelCase       (							a_					:		List[str]							)      ->				Dict:
      __SCREAMING_SNAKE_CASE       :Dict		    =  {}
      __SCREAMING_SNAKE_CASE       :Any		    =  tokenizer(example['''content''']			,       truncation=a_							)['''input_ids''']
      __SCREAMING_SNAKE_CASE       :Any		    =  len(example['''content''']							) / len(output['''input_ids''']							)
      return output


lowerCamelCase_       =		HfArgumentParser(PretokenizationArguments)
lowerCamelCase_       =		parser.parse_args()
if args.num_workers is None:
  lowerCamelCase_       =		multiprocessing.cpu_count()
lowerCamelCase_       =		AutoTokenizer.from_pretrained(args.tokenizer_dir)

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

lowerCamelCase_       =		time.time()
lowerCamelCase_       =		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')

lowerCamelCase_       =		time.time()
ds.push_to_hub(args.tokenized_data_repo)







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






"""simple docstring"""
def 					__lowerCamelCase       (							a_					:		int = 10			,       a_					:		int = 22							)      ->				int:
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  range(1			,       a_							)
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  range(1			,       a_							)
      return sum(
          1 for power in powers for base in bases if len(str(base**power							)							) == power							)


if __name__ == "__main__":
  print(f'{solution(1_0, 2_2) = }')