Skip to content

Commit

Permalink
add preprocessing_num_workers to run_classification.py (#31586)
Browse files Browse the repository at this point in the history
preprocessing_num_workers option to speedup preprocess
  • Loading branch information
jiahuanluo authored Jun 25, 2024
1 parent fc689d7 commit e73a97a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/pytorch/text-classification/run_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ class DataTrainingArguments:
)
},
)
preprocessing_num_workers: Optional[int] = field(
default=None,
metadata={"help": "The number of processes to use for the preprocessing."},
)
overwrite_cache: bool = field(
default=False, metadata={"help": "Overwrite the cached preprocessed datasets or not."}
)
Expand Down Expand Up @@ -573,6 +577,7 @@ def preprocess_function(examples):
raw_datasets = raw_datasets.map(
preprocess_function,
batched=True,
num_proc=data_args.preprocessing_num_workers,
load_from_cache_file=not data_args.overwrite_cache,
desc="Running tokenizer on dataset",
)
Expand Down

0 comments on commit e73a97a

Please sign in to comment.