"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "e3d2bee8d034e0c2f1dfbb5555e157b3c8d4b2a4"
Unverified Commit e73a97a2 authored by Locke's avatar Locke Committed by GitHub
Browse files

add preprocessing_num_workers to run_classification.py (#31586)

preprocessing_num_workers option to speedup preprocess
parent fc689d75
...@@ -133,6 +133,10 @@ class DataTrainingArguments: ...@@ -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( overwrite_cache: bool = field(
default=False, metadata={"help": "Overwrite the cached preprocessed datasets or not."} default=False, metadata={"help": "Overwrite the cached preprocessed datasets or not."}
) )
...@@ -573,6 +577,7 @@ def main(): ...@@ -573,6 +577,7 @@ def main():
raw_datasets = raw_datasets.map( raw_datasets = raw_datasets.map(
preprocess_function, preprocess_function,
batched=True, batched=True,
num_proc=data_args.preprocessing_num_workers,
load_from_cache_file=not data_args.overwrite_cache, load_from_cache_file=not data_args.overwrite_cache,
desc="Running tokenizer on dataset", desc="Running tokenizer on dataset",
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment