Commit
·
745d6c0
verified
·
0
Parent(s):
Duplicate from ivanzhouyq/RedPajama-Tiny
Browse filesCo-authored-by: Ivan Zhou <ivanzhouyq@users.noreply.huggingface.co>
- .gitattributes +56 -0
- .gitignore +1 -0
- README.md +29 -0
- RedPajama-Tiny.py +103 -0
- arxiv_sample.jsonl +0 -0
- book_sample.jsonl +3 -0
- c4_sample.jsonl +0 -0
- cc_2023-06_sample.jsonl +0 -0
- github_sample.jsonl +0 -0
- stackexchange_sample.jsonl +0 -0
- wikipedia_sample.jsonl +0 -0
.gitattributes
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
# Audio files - uncompressed
|
| 38 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
# Audio files - compressed
|
| 42 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
# Image files - uncompressed
|
| 48 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
# Image files - compressed
|
| 53 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
book_sample.jsonl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
sample.py
|
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
task_categories:
|
| 3 |
+
- text-generation
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
pretty_name: RedPajama Tiny
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
size_categories:
|
| 9 |
+
- n<1K
|
| 10 |
+
---
|
| 11 |
+
# Dataset Card for Dataset Name
|
| 12 |
+
|
| 13 |
+
### Dataset Summary
|
| 14 |
+
|
| 15 |
+
This is a tiny version of the [RedPajama dataset](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T).
|
| 16 |
+
It contains 64 samples from each of the 7 sources.
|
| 17 |
+
This dataset is intended for developing and testing data/training pipeline for loading the full RedPajama dataset or any general HuggingFace dataset.
|
| 18 |
+
It is very fast to download and easy to examine. You should not use it for training a full model, but you can use it for overfitting test or any other sanity checks.
|
| 19 |
+
|
| 20 |
+
## Dataset Structure
|
| 21 |
+
|
| 22 |
+
The dataset structure is as follows:
|
| 23 |
+
|
| 24 |
+
```
|
| 25 |
+
{
|
| 26 |
+
"text": ...,
|
| 27 |
+
"meta": {"url": "...", "timestamp": "...", "source": "...", "language": "...", ...}
|
| 28 |
+
}
|
| 29 |
+
```
|
RedPajama-Tiny.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2023 Together Computer
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
# Lint as: python3
|
| 16 |
+
"""RedPajama: An Open-Source, Clean-Room 1.2 Trillion Token Dataset."""
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
import json
|
| 20 |
+
|
| 21 |
+
import datasets
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
logger = datasets.logging.get_logger(__name__)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
_DESCRIPTION = """\
|
| 28 |
+
RedPajama is a clean-room, fully open-source implementation of the LLaMa dataset. This is a 1B-token sample of the full dataset.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
_URLS = [
|
| 32 |
+
"arxiv_sample.jsonl",
|
| 33 |
+
"book_sample.jsonl",
|
| 34 |
+
"c4_sample.jsonl",
|
| 35 |
+
"cc_2023-06_sample.jsonl",
|
| 36 |
+
"github_sample.jsonl",
|
| 37 |
+
"stackexchange_sample.jsonl",
|
| 38 |
+
"wikipedia_sample.jsonl",
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class RedPajamaTinyConfig(datasets.BuilderConfig):
|
| 43 |
+
"""BuilderConfig for RedPajama sample."""
|
| 44 |
+
|
| 45 |
+
def __init__(self, **kwargs):
|
| 46 |
+
"""BuilderConfig for RedPajama sample.
|
| 47 |
+
Args:
|
| 48 |
+
**kwargs: keyword arguments forwarded to super.
|
| 49 |
+
"""
|
| 50 |
+
super(RedPajamaTinyConfig, self).__init__(**kwargs)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class RedPajamaTiny(datasets.GeneratorBasedBuilder):
|
| 54 |
+
"""RedPajama 1T Sample: version 1.0.0."""
|
| 55 |
+
|
| 56 |
+
BUILDER_CONFIGS = [
|
| 57 |
+
RedPajamaTinyConfig(
|
| 58 |
+
name="plain_text",
|
| 59 |
+
version=datasets.Version("1.0.0", ""),
|
| 60 |
+
description="Plain text",
|
| 61 |
+
),
|
| 62 |
+
]
|
| 63 |
+
|
| 64 |
+
def _info(self):
|
| 65 |
+
return datasets.DatasetInfo(
|
| 66 |
+
description=_DESCRIPTION,
|
| 67 |
+
features=datasets.Features(
|
| 68 |
+
{
|
| 69 |
+
"text": datasets.Value("string"),
|
| 70 |
+
"meta": datasets.Value("string"),
|
| 71 |
+
}
|
| 72 |
+
),
|
| 73 |
+
supervised_keys=None,
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
def _split_generators(self, dl_manager):
|
| 77 |
+
downloaded_files = dl_manager.download_and_extract(_URLS)
|
| 78 |
+
|
| 79 |
+
return [
|
| 80 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": downloaded_files})
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
def _generate_examples(self, filepaths):
|
| 84 |
+
"""This function returns the examples in the raw (text) form."""
|
| 85 |
+
logger.info("generating examples from = %s", filepaths)
|
| 86 |
+
key = 0
|
| 87 |
+
for filepath in filepaths:
|
| 88 |
+
with open(filepath, encoding="utf-8") as f:
|
| 89 |
+
for row in f:
|
| 90 |
+
data = json.loads(row)
|
| 91 |
+
if "meta" not in data:
|
| 92 |
+
text = data["text"]
|
| 93 |
+
del data["text"]
|
| 94 |
+
yield key, {
|
| 95 |
+
"text": text,
|
| 96 |
+
"meta": json.dumps(data),
|
| 97 |
+
}
|
| 98 |
+
else:
|
| 99 |
+
yield key, {
|
| 100 |
+
"text": data["text"],
|
| 101 |
+
"meta": data["meta"],
|
| 102 |
+
}
|
| 103 |
+
key += 1
|
arxiv_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
book_sample.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23be3ce732640a7da34bfc61ff69befef5ca88ec51ee08c6e30d2637052fd4d8
|
| 3 |
+
size 28711073
|
c4_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
cc_2023-06_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
github_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
stackexchange_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
wikipedia_sample.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|