forked from huggingface/nanotron
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adding Megatron-Style input data pipelines #3
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Enhance docstring and type hints in get_local_rank for clarity - Simplify parameter names in get_global_rank for readability - Update tests for get_global_rank - Attempt to fix a bug related to get_local_rank
…ext_world_rank_matrix [Feature] Refactor ParallelContext.world_rank_matrix
…st_as_an_requirement [Docs] Add unit tests as a requirement
…set and BlendedNanoset to their respective files. Parameterized elements of the dataset and deleted random params. Updated to use collator and get_sampler func from dataloader.py
… to 1 assertion in build_nanoset_datasets_split
TJ-Solergibert
pushed a commit
to TJ-Solergibert/nanotron
that referenced
this pull request
May 27, 2024
already integrated upstream and resolved with the most recent sync. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The current version of Nanotron's input pipelines is based on Hugging Face Datasets and relies on
clm_preprocess
, which tokenises and preprocesses the entire dataset at the beginning of the training (linked to thesequence_length
, making it even more difficult to reuse the result across different experiments).I have developed new data input pipelines based on those included in Megatron. Since I didn't want Nanotron to lose its essence, I removed many functionalities that we don't need (such as those related to BERT models pretraining). What I mainly modified is the
torch.utils.data.Dataset
, and we continue to work with the same Sampler*, Collator* and DataLoader (* I had to modify them slightly), so it doesn't alter the behavior of other modules like the PipelineEngine at all. It also allows us to continue using the previous pipeline based on Hugging Face Datasets, since I added the scriptrun_train_nanoset.py
to launch the training with the new pipeline.Relevant details:
NanosetDatasetsArgs
, which can replace `PretrainDatasetsArgs. You only need to specify the path to the dataset (generated by Megatron's preprocess_data.py, without the extension as they specify) and the distribution of the dataset samples for each of the splits (train, valid, and test) so that it sums up to 1.Nanoset
will be the new dataset format. It is a lighter version ofGPTDataset
andMegatronDataset
from Megatron.NanosetBuilder
, which, based on aNanosetConfig
(ContainsNanosetDatasetsArgs
+ other details), will build aNanoset
for each split. In this first version, we only support one dataset file, but I will include the possibility of using multiple files (BlendedNanoset), hence preserving theNanosetBuilder
.Nanoset
contains anMMapIndexedDataset
. This object is found inindexed_dataset.py
and comes from fairseq. Megatron also includes it as such.I think maybe we should centralize the input data pipelines and perhaps move the
dataloader.py
file to another location. I also propose moving several functions from this file with the comments # Question:.To use the Nanoset datasets, you need to specify the
data_path
andsplit
fields inconfig.data.dataset
in the .yaml file and use the scriptrun_train_nanoset.py
in the same way asrun_train.py
.I've published the wandb logs of the different tests I have carried out, comparing the HF Datasets and the new Nanoset datasets with 1 and 4 GPUs and resuming training from a checkpoint.
This is a first version, I am open to all suggestions you can think of!
Toni