Squashing commit
Browse filesCo-authored-by: Dan Fu <Dan [email protected]>
Co-authored-by: danfu09 <[email protected]>
Co-authored-by: csris <[email protected]>
Co-authored-by: zhangce <[email protected]>
- .gitattributes +65 -0
 - README.md +129 -0
 - RedPajama-Data-1T-Sample.py +107 -0
 - arxiv_sample.jsonl +3 -0
 - book_sample.jsonl +3 -0
 - c4_sample.jsonl +3 -0
 - cc_2019-30_sample.jsonl +3 -0
 - cc_2020-05_sample.jsonl +3 -0
 - cc_2021-04_sample.jsonl +3 -0
 - cc_2022-05_sample.jsonl +3 -0
 - cc_2023-06_sample.jsonl +3 -0
 - github_sample.jsonl +3 -0
 - stackexchange_sample.jsonl +3 -0
 - wikipedia_sample.jsonl +3 -0
 
    	
        .gitattributes
    ADDED
    
    | 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 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 | 
         
            +
            *.tflite filter=lfs diff=lfs merge=lfs -text
         
     | 
| 30 | 
         
            +
            *.tgz filter=lfs diff=lfs merge=lfs -text
         
     | 
| 31 | 
         
            +
            *.wasm filter=lfs diff=lfs merge=lfs -text
         
     | 
| 32 | 
         
            +
            *.xz filter=lfs diff=lfs merge=lfs -text
         
     | 
| 33 | 
         
            +
            *.zip filter=lfs diff=lfs merge=lfs -text
         
     | 
| 34 | 
         
            +
            *.zst filter=lfs diff=lfs merge=lfs -text
         
     | 
| 35 | 
         
            +
            *tfevents* filter=lfs diff=lfs merge=lfs -text
         
     | 
| 36 | 
         
            +
            # Audio files - uncompressed
         
     | 
| 37 | 
         
            +
            *.pcm filter=lfs diff=lfs merge=lfs -text
         
     | 
| 38 | 
         
            +
            *.sam filter=lfs diff=lfs merge=lfs -text
         
     | 
| 39 | 
         
            +
            *.raw filter=lfs diff=lfs merge=lfs -text
         
     | 
| 40 | 
         
            +
            # Audio files - compressed
         
     | 
| 41 | 
         
            +
            *.aac filter=lfs diff=lfs merge=lfs -text
         
     | 
| 42 | 
         
            +
            *.flac filter=lfs diff=lfs merge=lfs -text
         
     | 
| 43 | 
         
            +
            *.mp3 filter=lfs diff=lfs merge=lfs -text
         
     | 
| 44 | 
         
            +
            *.ogg filter=lfs diff=lfs merge=lfs -text
         
     | 
| 45 | 
         
            +
            *.wav filter=lfs diff=lfs merge=lfs -text
         
     | 
| 46 | 
         
            +
            # Image files - uncompressed
         
     | 
| 47 | 
         
            +
            *.bmp filter=lfs diff=lfs merge=lfs -text
         
     | 
| 48 | 
         
            +
            *.gif filter=lfs diff=lfs merge=lfs -text
         
     | 
| 49 | 
         
            +
            *.png filter=lfs diff=lfs merge=lfs -text
         
     | 
| 50 | 
         
            +
            *.tiff filter=lfs diff=lfs merge=lfs -text
         
     | 
| 51 | 
         
            +
            # Image files - compressed
         
     | 
| 52 | 
         
            +
            *.jpg filter=lfs diff=lfs merge=lfs -text
         
     | 
| 53 | 
         
            +
            *.jpeg filter=lfs diff=lfs merge=lfs -text
         
     | 
| 54 | 
         
            +
            *.webp filter=lfs diff=lfs merge=lfs -text
         
     | 
| 55 | 
         
            +
            arxiv_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 56 | 
         
            +
            book_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 57 | 
         
            +
            c4_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 58 | 
         
            +
            stackexchange_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 59 | 
         
            +
            wikipedia_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 60 | 
         
            +
            cc_2019-30_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 61 | 
         
            +
            cc_2020-05_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 62 | 
         
            +
            cc_2021-04_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 63 | 
         
            +
            cc_2022-05_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 64 | 
         
            +
            github_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
| 65 | 
         
            +
            cc_2023-06_sample.jsonl filter=lfs diff=lfs merge=lfs -text
         
     | 
    	
        README.md
    ADDED
    
    | 
         @@ -0,0 +1,129 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            ---
         
     | 
| 2 | 
         
            +
            task_categories:
         
     | 
| 3 | 
         
            +
            - text-generation
         
     | 
| 4 | 
         
            +
            language:
         
     | 
| 5 | 
         
            +
            - en
         
     | 
| 6 | 
         
            +
            pretty_name: Red Pajama 1T Sample
         
     | 
| 7 | 
         
            +
            ---
         
     | 
| 8 | 
         
            +
            # Dataset Card for Dataset Name
         
     | 
| 9 | 
         
            +
             
     | 
| 10 | 
         
            +
            ### Dataset Summary
         
     | 
| 11 | 
         
            +
             
     | 
| 12 | 
         
            +
            RedPajama is a clean-room, fully open-source implementation of the LLaMa dataset.
         
     | 
| 13 | 
         
            +
            This HuggingFace repo contains a 1B-token sample of the RedPajama dataset.
         
     | 
| 14 | 
         
            +
            The full dataset has the following token counts and is available for [download]( https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T):
         
     | 
| 15 | 
         
            +
             
     | 
| 16 | 
         
            +
            | Dataset       | Token Count |
         
     | 
| 17 | 
         
            +
            |---------------|-------------|
         
     | 
| 18 | 
         
            +
            | Commoncrawl   | 878 Billion        |
         
     | 
| 19 | 
         
            +
            | C4            | 175 Billion        |
         
     | 
| 20 | 
         
            +
            | GitHub        | 59 Billion         |
         
     | 
| 21 | 
         
            +
            | Books         | 26 Billion         |
         
     | 
| 22 | 
         
            +
            | ArXiv         | 28 Billion         |
         
     | 
| 23 | 
         
            +
            | Wikipedia     | 24 Billion         |
         
     | 
| 24 | 
         
            +
            | StackExchange | 20 Billion         |
         
     | 
| 25 | 
         
            +
            | Total         | 1.2 Trillion      |
         
     | 
| 26 | 
         
            +
             
     | 
| 27 | 
         
            +
            A full set of scripts to recreate the dataset from scratch can be found [here](https://github.com/togethercomputer/RedPajama-Data).
         
     | 
| 28 | 
         
            +
             
     | 
| 29 | 
         
            +
            ### Languages
         
     | 
| 30 | 
         
            +
             
     | 
| 31 | 
         
            +
            Primarily English, though the Wikipedia slice contains multiple languages.
         
     | 
| 32 | 
         
            +
             
     | 
| 33 | 
         
            +
            ## Dataset Structure
         
     | 
| 34 | 
         
            +
             
     | 
| 35 | 
         
            +
            The dataset structure is as follows:
         
     | 
| 36 | 
         
            +
             
     | 
| 37 | 
         
            +
            ```
         
     | 
| 38 | 
         
            +
            {
         
     | 
| 39 | 
         
            +
                "text": ...,
         
     | 
| 40 | 
         
            +
                "meta": {"url": "...", "timestamp": "...", "source": "...", "language": "...", ...}
         
     | 
| 41 | 
         
            +
            }
         
     | 
| 42 | 
         
            +
            ```
         
     | 
| 43 | 
         
            +
             
     | 
| 44 | 
         
            +
            ## Dataset Creation
         
     | 
| 45 | 
         
            +
             
     | 
| 46 | 
         
            +
            This dataset was created to follow the LLaMa paper as closely as possible to try to reproduce its recipe.
         
     | 
| 47 | 
         
            +
             
     | 
| 48 | 
         
            +
            ### Source Data
         
     | 
| 49 | 
         
            +
             
     | 
| 50 | 
         
            +
            #### Commoncrawl
         
     | 
| 51 | 
         
            +
             
     | 
| 52 | 
         
            +
            We download five dumps from Commoncrawl, and run the dumps through the official `cc_net` pipeline.
         
     | 
| 53 | 
         
            +
            We then deduplicate on the paragraph level, and filter out low quality text using a linear classifier trained to 
         
     | 
| 54 | 
         
            +
            classify paragraphs as Wikipedia references or random Commoncrawl samples.
         
     | 
| 55 | 
         
            +
             
     | 
| 56 | 
         
            +
            #### C4
         
     | 
| 57 | 
         
            +
             
     | 
| 58 | 
         
            +
            C4 is downloaded from Huggingface. The only preprocessing step is to bring the data into our own format.
         
     | 
| 59 | 
         
            +
             
     | 
| 60 | 
         
            +
            #### GitHub
         
     | 
| 61 | 
         
            +
             
     | 
| 62 | 
         
            +
            The raw GitHub data is downloaded from Google BigQuery. We deduplicate on the file level and filter out low quality 
         
     | 
| 63 | 
         
            +
            files and only keep projects that are distributed under the MIT, BSD, or Apache license.
         
     | 
| 64 | 
         
            +
             
     | 
| 65 | 
         
            +
            #### Wikipedia
         
     | 
| 66 | 
         
            +
            We use the Wikipedia dataset available on Huggingface, which is based on the Wikipedia dump from 2023-03-20 and contains
         
     | 
| 67 | 
         
            +
            text in 20 different languages. The dataset comes in preprocessed format, so that hyperlinks, comments and other 
         
     | 
| 68 | 
         
            +
            formatting boilerplate has been removed.
         
     | 
| 69 | 
         
            +
             
     | 
| 70 | 
         
            +
            #### Gutenberg and Books3
         
     | 
| 71 | 
         
            +
            The PG19 subset of the Gutenberg Project and Books3 datasets are downloaded from Huggingface. After downloading, we use 
         
     | 
| 72 | 
         
            +
            simhash to remove near duplicates.
         
     | 
| 73 | 
         
            +
             
     | 
| 74 | 
         
            +
            #### ArXiv
         
     | 
| 75 | 
         
            +
            ArXiv data is downloaded from Amazon S3 in the `arxiv` requester pays bucket. We only keep latex source files and 
         
     | 
| 76 | 
         
            +
            remove preambles, comments, macros and bibliographies.
         
     | 
| 77 | 
         
            +
             
     | 
| 78 | 
         
            +
            #### Stackexchange
         
     | 
| 79 | 
         
            +
            The Stack Exchange split of the dataset is download from the 
         
     | 
| 80 | 
         
            +
            [Internet Archive](https://archive.org/download/stackexchange). Here we only keep the posts from the 28 largest sites,
         
     | 
| 81 | 
         
            +
            remove html tags, group the posts into question-answer pairs, and order answers by their score.
         
     | 
| 82 | 
         
            +
             
     | 
| 83 | 
         
            +
            <!--
         
     | 
| 84 | 
         
            +
            ### Annotations
         
     | 
| 85 | 
         
            +
             
     | 
| 86 | 
         
            +
            #### Annotation process
         
     | 
| 87 | 
         
            +
             
     | 
| 88 | 
         
            +
            [More Information Needed]
         
     | 
| 89 | 
         
            +
             
     | 
| 90 | 
         
            +
            #### Who are the annotators?
         
     | 
| 91 | 
         
            +
             
     | 
| 92 | 
         
            +
            [More Information Needed]
         
     | 
| 93 | 
         
            +
             
     | 
| 94 | 
         
            +
            ### Personal and Sensitive Information
         
     | 
| 95 | 
         
            +
             
     | 
| 96 | 
         
            +
            [More Information Needed]
         
     | 
| 97 | 
         
            +
             
     | 
| 98 | 
         
            +
            ## Considerations for Using the Data
         
     | 
| 99 | 
         
            +
             
     | 
| 100 | 
         
            +
            ### Social Impact of Dataset
         
     | 
| 101 | 
         
            +
             
     | 
| 102 | 
         
            +
            [More Information Needed]
         
     | 
| 103 | 
         
            +
             
     | 
| 104 | 
         
            +
            ### Discussion of Biases
         
     | 
| 105 | 
         
            +
             
     | 
| 106 | 
         
            +
            [More Information Needed]
         
     | 
| 107 | 
         
            +
             
     | 
| 108 | 
         
            +
            ### Other Known Limitations
         
     | 
| 109 | 
         
            +
             
     | 
| 110 | 
         
            +
            [More Information Needed]
         
     | 
| 111 | 
         
            +
             
     | 
| 112 | 
         
            +
            ## Additional Information
         
     | 
| 113 | 
         
            +
             
     | 
| 114 | 
         
            +
            ### Dataset Curators
         
     | 
| 115 | 
         
            +
             
     | 
| 116 | 
         
            +
            [More Information Needed]
         
     | 
| 117 | 
         
            +
             
     | 
| 118 | 
         
            +
            ### Licensing Information
         
     | 
| 119 | 
         
            +
             
     | 
| 120 | 
         
            +
            [More Information Needed]
         
     | 
| 121 | 
         
            +
             
     | 
| 122 | 
         
            +
            ### Citation Information
         
     | 
| 123 | 
         
            +
             
     | 
| 124 | 
         
            +
            [More Information Needed]
         
     | 
| 125 | 
         
            +
             
     | 
| 126 | 
         
            +
            ### Contributions
         
     | 
| 127 | 
         
            +
             
     | 
| 128 | 
         
            +
            [More Information Needed]
         
     | 
| 129 | 
         
            +
            -->
         
     | 
    	
        RedPajama-Data-1T-Sample.py
    ADDED
    
    | 
         @@ -0,0 +1,107 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 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_2019-30_sample.jsonl",
         
     | 
| 36 | 
         
            +
                "cc_2020-05_sample.jsonl",
         
     | 
| 37 | 
         
            +
                "cc_2021-04_sample.jsonl",
         
     | 
| 38 | 
         
            +
                "cc_2022-05_sample.jsonl",
         
     | 
| 39 | 
         
            +
                "cc_2023-06_sample.jsonl",
         
     | 
| 40 | 
         
            +
                "github_sample.jsonl",
         
     | 
| 41 | 
         
            +
                "stackexchange_sample.jsonl",
         
     | 
| 42 | 
         
            +
                "wikipedia_sample.jsonl",
         
     | 
| 43 | 
         
            +
            ]
         
     | 
| 44 | 
         
            +
             
     | 
| 45 | 
         
            +
             
     | 
| 46 | 
         
            +
            class RedPajama1TSampleConfig(datasets.BuilderConfig):
         
     | 
| 47 | 
         
            +
                """BuilderConfig for RedPajama sample."""
         
     | 
| 48 | 
         
            +
             
     | 
| 49 | 
         
            +
                def __init__(self, **kwargs):
         
     | 
| 50 | 
         
            +
                    """BuilderConfig for RedPajama sample.
         
     | 
| 51 | 
         
            +
                    Args:
         
     | 
| 52 | 
         
            +
                      **kwargs: keyword arguments forwarded to super.
         
     | 
| 53 | 
         
            +
                    """
         
     | 
| 54 | 
         
            +
                    super(RedPajama1TSampleConfig, self).__init__(**kwargs)
         
     | 
| 55 | 
         
            +
             
     | 
| 56 | 
         
            +
             
     | 
| 57 | 
         
            +
            class RedPajama1TSample(datasets.GeneratorBasedBuilder):
         
     | 
| 58 | 
         
            +
                """RedPajama 1T Sample: version 1.0.0."""
         
     | 
| 59 | 
         
            +
             
     | 
| 60 | 
         
            +
                BUILDER_CONFIGS = [
         
     | 
| 61 | 
         
            +
                    RedPajama1TSampleConfig(
         
     | 
| 62 | 
         
            +
                        name="plain_text",
         
     | 
| 63 | 
         
            +
                        version=datasets.Version("1.0.0", ""),
         
     | 
| 64 | 
         
            +
                        description="Plain text",
         
     | 
| 65 | 
         
            +
                    ),
         
     | 
| 66 | 
         
            +
                ]
         
     | 
| 67 | 
         
            +
             
     | 
| 68 | 
         
            +
                def _info(self):
         
     | 
| 69 | 
         
            +
                    return datasets.DatasetInfo(
         
     | 
| 70 | 
         
            +
                        description=_DESCRIPTION,
         
     | 
| 71 | 
         
            +
                        features=datasets.Features(
         
     | 
| 72 | 
         
            +
                            {
         
     | 
| 73 | 
         
            +
                                "text": datasets.Value("string"),
         
     | 
| 74 | 
         
            +
                                "meta": datasets.Value("string"),
         
     | 
| 75 | 
         
            +
                            }
         
     | 
| 76 | 
         
            +
                        ),
         
     | 
| 77 | 
         
            +
                        supervised_keys=None,
         
     | 
| 78 | 
         
            +
                    )
         
     | 
| 79 | 
         
            +
             
     | 
| 80 | 
         
            +
                def _split_generators(self, dl_manager):
         
     | 
| 81 | 
         
            +
                    downloaded_files = dl_manager.download_and_extract(_URLS)
         
     | 
| 82 | 
         
            +
             
     | 
| 83 | 
         
            +
                    return [
         
     | 
| 84 | 
         
            +
                        datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": downloaded_files})
         
     | 
| 85 | 
         
            +
                    ]
         
     | 
| 86 | 
         
            +
             
     | 
| 87 | 
         
            +
                def _generate_examples(self, filepaths):
         
     | 
| 88 | 
         
            +
                    """This function returns the examples in the raw (text) form."""
         
     | 
| 89 | 
         
            +
                    logger.info("generating examples from = %s", filepaths)
         
     | 
| 90 | 
         
            +
                    key = 0
         
     | 
| 91 | 
         
            +
                    for filepath in filepaths:
         
     | 
| 92 | 
         
            +
                        with open(filepath, encoding="utf-8") as f:
         
     | 
| 93 | 
         
            +
                            for row in f:
         
     | 
| 94 | 
         
            +
                                data = json.loads(row)
         
     | 
| 95 | 
         
            +
                                if "meta" not in data:
         
     | 
| 96 | 
         
            +
                                    text = data["text"]
         
     | 
| 97 | 
         
            +
                                    del data["text"]
         
     | 
| 98 | 
         
            +
                                    yield key, {
         
     | 
| 99 | 
         
            +
                                        "text": text,
         
     | 
| 100 | 
         
            +
                                        "meta": json.dumps(data),
         
     | 
| 101 | 
         
            +
                                    }
         
     | 
| 102 | 
         
            +
                                else:
         
     | 
| 103 | 
         
            +
                                    yield key, {
         
     | 
| 104 | 
         
            +
                                        "text": data["text"],
         
     | 
| 105 | 
         
            +
                                        "meta": data["meta"],
         
     | 
| 106 | 
         
            +
                                    }
         
     | 
| 107 | 
         
            +
                                key += 1
         
     | 
    	
        arxiv_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:50b89a49a630b8971231d801982c0a27720585e82bbd5768f61794e167c2c006
         
     | 
| 3 | 
         
            +
            size 93439018
         
     | 
    	
        book_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:755329b74f6b550095e8e5bf6d181c4ef58cac77cc1d9720e65c68d9b4da47a3
         
     | 
| 3 | 
         
            +
            size 110562853
         
     | 
    	
        c4_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:3409bc47c62db7fc085b37b9f4b521f689bc609e5fea0c9fca545483cd40d953
         
     | 
| 3 | 
         
            +
            size 865912103
         
     | 
    	
        cc_2019-30_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:5d9d1556fd23d1ee695b53ffbe1c14dd2609a15be0cc6e04112565b1d3433100
         
     | 
| 3 | 
         
            +
            size 688564202
         
     | 
    	
        cc_2020-05_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:6e941bf56c1ce85683b6a7e41d02e7233bcefacf8fc6fdfc50f59b64b88e4329
         
     | 
| 3 | 
         
            +
            size 836081051
         
     | 
    	
        cc_2021-04_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:3b932b6b3d954d4022c73c20ecd1f7183e6bf80a80baa85eb2930a5e1aa8b488
         
     | 
| 3 | 
         
            +
            size 802416611
         
     | 
    	
        cc_2022-05_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:2c17d20de1d15b82590be7b25453e473d2d756ebb8976cd00a3e2e4cf26295cd
         
     | 
| 3 | 
         
            +
            size 737358174
         
     | 
    	
        cc_2023-06_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:4be72f96a32f717237656bf766d675a926557082c40e6ea54b6b61acb1644183
         
     | 
| 3 | 
         
            +
            size 857090810
         
     | 
    	
        github_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:191c3aa6a61e41ccf0e5fcac9069e9051c16cdce36b7fb0a83de803af1a9770d
         
     | 
| 3 | 
         
            +
            size 222243898
         
     | 
    	
        stackexchange_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:30fe5ddc4e470abad0492e50b6b3e7997b04053df5ea8d0777bdb76567de65b3
         
     | 
| 3 | 
         
            +
            size 80502344
         
     | 
    	
        wikipedia_sample.jsonl
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:c3a929ff343c87b4cfa5c6373a2f99da7ce0a70748aaf022f985fc9140fd2454
         
     | 
| 3 | 
         
            +
            size 118520815
         
     |