|
--- |
|
language: |
|
- ms |
|
--- |
|
|
|
# Mosaic format for filtered combine dataset to finetune TinyLlama models |
|
|
|
This repository is to store dataset shards using mosaic format. |
|
|
|
1. https://github.com/malaysia-ai/dedup-text-dataset/blob/main/tinyllama/combine-dataset.ipynb |
|
2. using tokenizer https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-955k-token-2T |
|
3. 4096 context length. |
|
|
|
## how-to |
|
|
|
1. git clone, |
|
|
|
```bash |
|
git lfs clone https://huggingface.co/datasets/malaysia-ai/mosaic-tinyllama |
|
``` |
|
|
|
2. load it, |
|
|
|
```python |
|
from streaming import LocalDataset |
|
import numpy as np |
|
from streaming.base.format.mds.encodings import Encoding, _encodings |
|
|
|
class UInt16(Encoding): |
|
def encode(self, obj) -> bytes: |
|
return obj.tobytes() |
|
|
|
def decode(self, data: bytes): |
|
return np.frombuffer(data, np.uint16) |
|
|
|
_encodings['uint16'] = UInt16 |
|
|
|
dataset = LocalDataset('mosaic-tinyllama') |
|
len(dataset) |
|
``` |