Index
optimus_dl.recipe.pretokenize
¶
DataPrepConfig
dataclass
¶
DataPrepConfig(dataset: optimus_dl.recipe.pretokenize.config.DatasetConfig =
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
DatasetConfig
|
DatasetConfig(repo_id: str = '???', split: str = 'train', config_name: str | None = None, cache_dir: str | None = None, file_pattern: str | None = None) |
<dynamic>
|
processing
|
ProcessingConfig
|
ProcessingConfig(shard_size_mb: int = 512, shuffle_buffer_size: int = 10000, text_column: str = 'text', seed: int = 42, dtype: str = 'uint16', num_proc: int = 1) |
<dynamic>
|
output
|
OutputConfig
|
OutputConfig(dir: str = '???', name: str = 'dataset') |
<dynamic>
|
tokenizer
|
Any
|
|
'???'
|
Source code in optimus_dl/recipe/pretokenize/config.py
DataPrepRecipe
¶
Recipe for preparing and tokenizing datasets.
Orchestrates the entire ETL pipeline:
1. Extract: Finds files from a Hugging Face Hub repository using FileFinder.
2. Transform: Tokenizes text documents in parallel using TokenProcessor.
3. Load: Writes tokenized data into sharded numpy files using Sharder.
Handles resumption from interruptions via atomic checkpointing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
DataPrepConfig
|
Data preparation configuration. |
required |
Source code in optimus_dl/recipe/pretokenize/recipe.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
run()
¶
Executes the data preparation pipeline.
Finds files, resumes from checkpoint if available, and processes data
until completion. Finalizes by writing the index.json.
Source code in optimus_dl/recipe/pretokenize/recipe.py
Modules and Sub-packages¶
checkpoint: Manages saving and loading of data preparation checkpoints.config: Configuration for data preparation recipe.processor: Handles the tokenization of source files using a high-performance parallel pipeline.recipe: Recipe for preparing and tokenizing datasets.sharder: Handles writing tokenized documents into sized-shards on disksource: Handles finding and reading data from various sources.