-
Notifications
You must be signed in to change notification settings - Fork 85
Enhancement - Fix preprocessing crash when num_workers=0 in Megatron GPT3 dataset generation #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -651,13 +651,16 @@ def _generate_dataset(self): | |
| if self._args.dataset_url: | ||
| self._raw_data_path = str(Path(self._args.data_home) / 'data.json') | ||
| download_file(self._args.dataset_url, self._raw_data_path) | ||
|
|
||
| command = ( | ||
| 'python3 ' | ||
| f'{os.path.join(self._args.code_base, "tools/preprocess_data.py")} ' | ||
| f'--input {self._raw_data_path} ' | ||
| f'--tokenizer-type {self._args.tokenizer_type} ' | ||
| f'--output-prefix {os.path.join(self._args.data_home, "dataset")} ' | ||
| f'--workers {str(self._args.num_workers)} ' | ||
| # num_workers=0 is valid for DataLoader (main process loads data), | ||
| # but preprocess_data.py requires workers>=1 for multiprocessing.Pool. | ||
| f'--workers {max(1, self._args.num_workers)} ' | ||
| f'--vocab-file {self._vocab_path} ' | ||
|
Comment on lines
659
to
664
|
||
| f'--merge-file {self._merges_path}' | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
max(1, self._args.num_workers)clamp is a regression-critical behavior change (fixing themultiprocessing.Pool(0)crash), but there’s no unit test asserting that--workerspassed topreprocess_data.pyis at least 1 when--num_workers=0. Since this benchmark already has tests, consider adding a test that exercises_generate_dataset()withnum_workers=0and asserts the constructed preprocess command uses--workers 1.