Curator icon indicating copy to clipboard operation
Curator copied to clipboard

Add additional write stage for merging multiple Megatron `IndexedDataset` file pairs into one

Open shaltielshmid opened this issue 10 months ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently, when I use the MegatronTokenizerWriter, it creates individual .bin/.idx file pairs, for each worker. This is obviously needed for efficiency, but when running on a machine with a lot of vCPUs, I got >100 different file pairs - which make it difficult to work with.

Describe the solution you'd like

It would be very helpful to be able to add some post-processing stage which merges all of them into a single output file. It can either be part of the same stage, or an additional optional stage in the pipeline.

Describe alternatives you've considered

A workaround solution is to run the merge_datasets.py script from Megatron-LM. Ideally if this could be part of the pipeline, it would simplify the process - especially since installing megatron-core requires a lot of dependencies, and it would be simpler to work within a single env with NeMo-Curator.

shaltielshmid avatar Jan 20 '26 17:01 shaltielshmid

@asolergi-nv is this fixed now?

arhamm1 avatar May 28 '26 19:05 arhamm1

@arhamm1 In https://github.com/NVIDIA-NeMo/Curator/pull/1427 we introduced nemo_curator/utils/merge_file_prefixes.py

asolergi-nv avatar May 29 '26 08:05 asolergi-nv