|
47 | 47 | import hashlib |
48 | 48 | import json |
49 | 49 | import time |
| 50 | +from collections.abc import Callable, Mapping |
50 | 51 | from dataclasses import asdict, dataclass |
51 | 52 | from pathlib import Path |
52 | | -from typing import TYPE_CHECKING, Any, Mapping |
| 53 | +from typing import TYPE_CHECKING, Any |
53 | 54 |
|
54 | 55 | import cosmos_xenna.pipelines.v1 as pipelines_v1 |
55 | | - |
56 | | -from collections.abc import Callable |
57 | 56 | from fsspec import AbstractFileSystem |
58 | 57 |
|
59 | 58 | from nemotron.data_prep.config import ( |
|
64 | 63 | ObservabilityConfig, |
65 | 64 | TokenizerConfig, |
66 | 65 | ) |
67 | | -from nemotron.data_prep.observability import pipeline_wandb_hook |
68 | | -from nemotron.data_prep.utils.filesystem import ensure_dir, get_filesystem, write_json |
69 | 66 | from nemotron.data_prep.core.finalize import scan_dataset_receipts |
70 | 67 | from nemotron.data_prep.core.planning import PlanRequest, resolve_tokenizer, verify_binidx_output |
| 68 | +from nemotron.data_prep.core.work_items import DatasetWorkItem, ShardWorkItem |
| 69 | +from nemotron.data_prep.observability import pipeline_wandb_hook |
| 70 | +from nemotron.data_prep.recipes.execution_mode import ExecutionModeRequest, resolve_execution_mode |
71 | 71 | from nemotron.data_prep.stages import ( |
72 | 72 | BinIdxTokenizationStage, |
73 | 73 | BinIdxTokenizationStageConfig, |
|
77 | 77 | PlanStage, |
78 | 78 | PlanStageConfig, |
79 | 79 | ) |
| 80 | +from nemotron.data_prep.utils.filesystem import ensure_dir, get_filesystem, write_json |
80 | 81 | from nemotron.data_prep.utils.hf_env import detect_hf_env_vars |
81 | | -from nemotron.data_prep.core.work_items import DatasetWorkItem, ShardWorkItem |
82 | | -from nemotron.data_prep.recipes.execution_mode import ExecutionModeRequest, resolve_execution_mode |
83 | 82 |
|
84 | 83 | if TYPE_CHECKING: |
85 | 84 | from nemotron.data_prep.blend import DataBlend |
@@ -122,6 +121,7 @@ def to_plan_request(self, item: DatasetWorkItem) -> PlanRequest: |
122 | 121 | weight=item.weight, |
123 | 122 | split=item.split, |
124 | 123 | subset=item.subset, |
| 124 | + revision=item.revision, |
125 | 125 | text_field=item.text_field, |
126 | 126 | ), |
127 | 127 | num_shards=item.num_shards, |
@@ -183,7 +183,7 @@ def _normalize_tokenizer(tokenizer: TokenizerConfig | Mapping[str, Any] | str) - |
183 | 183 |
|
184 | 184 |
|
185 | 185 | def setup_pretrain_run( |
186 | | - blend: "DataBlend", |
| 186 | + blend: DataBlend, |
187 | 187 | output_dir: str | Path, |
188 | 188 | tokenizer: TokenizerConfig | Mapping[str, Any] | str, |
189 | 189 | *, |
@@ -234,6 +234,7 @@ def setup_pretrain_run( |
234 | 234 | "weight": d.weight, |
235 | 235 | "split": d.split, |
236 | 236 | "subset": d.subset, |
| 237 | + "revision": d.revision, |
237 | 238 | "text_field": getattr(d, "text_field", None) or text_field_default, |
238 | 239 | } |
239 | 240 | for d in blend.datasets |
@@ -270,6 +271,7 @@ def setup_pretrain_run( |
270 | 271 | weight=d.weight, |
271 | 272 | split=d.split, |
272 | 273 | subset=d.subset, |
| 274 | + revision=d.revision, |
273 | 275 | text_field=getattr(d, "text_field", None) or text_field_default, |
274 | 276 | run_hash=run_hash, |
275 | 277 | run_dir=run_dir, |
@@ -297,7 +299,7 @@ def setup_pretrain_run( |
297 | 299 |
|
298 | 300 | def finalize_pretrain_run( |
299 | 301 | context: PretrainRunContext, |
300 | | - blend: "DataBlend", |
| 302 | + blend: DataBlend, |
301 | 303 | output_dir: str | Path, |
302 | 304 | ) -> FormatResult: |
303 | 305 | """ |
@@ -360,7 +362,7 @@ def finalize_pretrain_run( |
360 | 362 |
|
361 | 363 |
|
362 | 364 | def run_pretrain_pipeline( |
363 | | - blend: "DataBlend", |
| 365 | + blend: DataBlend, |
364 | 366 | output_dir: str | Path, |
365 | 367 | tokenizer: TokenizerConfig | Mapping[str, Any] | str, |
366 | 368 | *, |
|
0 commit comments