NVIDIA / NVIDIA/Megatron-LM

[QUESTION] Dataset construction behavior for variable-length documents

Open
#1,639 1 comment 0 reactions 0 assignees View on GitHub
documentation question
Dominant language
Python
Stars
17.9k
Forks
4.5k
Avg merge
4d 6h
Merged PRs (30d)
271

Description

**Your question**
I'd like to know the dataset preprocessing behavior when working with documents of varying lengths. Here's my scenario:

- I've preprocessed a dataset containing 128k-token sequence
- I'm training with seq_length=32k

My questions regarding the dataset construction process:

For documents exceeding 32k tokens (like my 128k-token samples), does the `build_sample_idx` (https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/core/datasets/helpers.cpp#L143) function truncate them to the sequence length?

For documents shorter than 32k tokens, does the implementation perform sequence packing to combine multiple short documents into ~32k-length training samples?

Could you please confirm this behavior? I want to ensure I understand how the dataset builder handles both long and short documents relative to the target sequence length.

Thank you for your reply!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.