hylcool's picture
Update README.md
f5beed8
metadata
license: apache-2.0
task_categories:
  - text-generation
language:
  - en
tags:
  - data-juicer
  - pretraining
size_categories:
  - 10M<n<100M

RedPajama & TheStack -- Github Code (refined by Data-Juicer)

A refined version of Github Code dataset in RedPajama & TheStack by Data-Juicer. Removing some "bad" samples from the original dataset to make it higher-quality.

This dataset is usually used to pretrain a Large Language Model.

Notice: Here is a small subset for previewing. The whole dataset is available here (About 232GB).

Dataset Information

  • Number of samples: 49,279,344 (Keep ~52.09% from the original dataset)

Refining Recipe

RedPajama code refinement

# global parameters
project_name: 'Data-Juicer-recipes-code-rp'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl'

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments
process:
  - clean_email_mapper:
  - clean_links_mapper:
  - fix_unicode_mapper:
  - punctuation_normalization_mapper:
  - whitespace_normalization_mapper:
  - clean_copyright_mapper:

  - alphanumeric_filter:
      tokenization: False
      min_ratio: 0.4
      max_ratio: 0.8
  - alphanumeric_filter:
      tokenization: True
      min_ratio: 1.5
      max_ratio: 3
  - average_line_length_filter:
      min_len: 15
      max_len: 100
  - character_repetition_filter:
      rep_len: 10
      min_ratio: 0.05
      max_ratio: 0.3
  - maximum_line_length_filter:
      min_len: 50
      max_len: 500
  - text_length_filter:
      min_len: 300
  - words_num_filter:
      lang: en
      tokenization: False
      min_num: 30
      max_num: 5000
  - word_repetition_filter:
      lang: en
      tokenization: False
      rep_len: 10
      max_ratio: 0.1
  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4

TheStack code refinement (only max_stars_count >= 20)

# global parameters
project_name: 'Data-Juicer-recipes-the-stack'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl'

text_key: 'content'

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments
process:
  - clean_email_mapper:
  - clean_links_mapper:
  - fix_unicode_mapper:
  - punctuation_normalization_mapper:
  - whitespace_normalization_mapper:
  - clean_copyright_mapper:

  - alphanumeric_filter:  # 18766
      tokenization: false
      min_ratio: 0.2  # < 3sigma (0.3791)
      max_ratio: 0.9163  # 3sigma
  - alphanumeric_filter:  # 146432
      tokenization: true
      min_ratio: 0.546  # 3sigma
      max_ratio: 3.65  # 3sigma
  - average_line_length_filter:  # for code
      min_len: 10  # > 3sigma (0) -- 48790
      max_len: 150  # < 3sigma (15603) -- 233275
  - character_repetition_filter:
      max_ratio: 0.36  # 3sigma -- 346875
  - maximum_line_length_filter:  # for code
      max_len: 1000  # remove 256670 samples
  - text_length_filter:
      max_len: 96714  # 3sigma -- 190006
  - words_num_filter:
      min_num: 20  # remove 1504958 samples
      max_num: 6640  # 3sigma -- remove 179847 samples
  - word_repetition_filter:
      rep_len: 10
      max_ratio: 0.357  # 3sigma -- 598462

  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4

Merge and Remove Duplicate Samples

project_name: 'Data-Juicer-recipes-code'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl' # path to your dataset result file

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments

process:
  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4