Lightning-AI / Lightning-AI/litgpt

[Question] Usage of sep token in prepare_redpajama.py

Open
#706 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted question
Dominant language
Python
Stars
13.7k
Forks
1.5k
Avg merge
15h 37m
Merged PRs (30d)
1

Description

Hi,

While reviewing the [`prepare_redpajama.py`](https://github.com/Lightning-AI/lit-gpt/blob/main/scripts/prepare_redpajama.py) script, I came across the preprocessing step involving the `PackedDatasetBuilder` class. I noticed that during initialization, the class seems to fill the `_arr` entirely with `_sep_token`.

However, it caught my attention that the `add_array` method does not insert `_sep_token` between different documents. It appears that the `_sep_token` is only present at the end of the last chunk. I am curious if this is intentional, possibly because there is no need to mark the end of documents during pretraining procedure?

Thank you for your time and assistance.

cc @awaelchli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/prepare_redpajama.py and trace the PackedDatasetBuilder initialization, _arr contents, and add_array method. Compare how _sep_token is handled across document boundaries and chunks. Done means the intended behavior is established and documented clearly, or a focused follow-up change is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.