Lightning-AI / Lightning-AI/litData
TokensLoader with parallel meta field
- Dominant language
- Python
- Stars
- 614
- Forks
- 106
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 22
Description
## 🚀 Feature
Add a `TokensLoaderWithMeta` class that stores some additional parallel meta data with the tokens. It can be used to store data with a bit more structure than flat sequence, like image tokens. Here's an example:
```python
{
"token": [1,2,3,4,5],
"token_x": [0,0,0,1,1],
"token_y": [0,1,2,0,1]
}
```
Notice they all have the same length.
### Motivation
I've been using TokensLoader to train models and find it to be really handy. But it's unfortunately a bit difficult to use when I want to experiment with different positional encoding schemes.
### Alternatives
The alternative is to create a normal LitDataset with these. But it is less efficient to store, load, and harder to pack samples.
Contributor guide
Research direction
Start by reading the existing TokensLoader entry point and its sample packing and loading behavior. Compare how the proposed TokensLoaderWithMeta should preserve equal-length parallel fields such as token_x and token_y, and consider the existing LitDataset alternative. Done means structured token data can be stored and loaded with the same-length metadata fields described in the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100