train: shard_dataset -- static-review fixes: absolute-step cursor, hub_listing pagination, cursor required on resume, repo_type everywhere, rank-0 repo create
Browse files- train/shard_dataset.py +10 -5
train/shard_dataset.py
CHANGED
|
@@ -121,11 +121,16 @@ def make_dataset(store, seq_len, seed, start_sample=0, count=None, shuffle=True)
|
|
| 121 |
return _DS()
|
| 122 |
|
| 123 |
|
| 124 |
-
def cursor_dict(seq_len,
|
| 125 |
-
"""The whole of the data-position state. Written into every checkpoint, checked on every resume.
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
def load_cursor(dirpath):
|
|
|
|
| 121 |
return _DS()
|
| 122 |
|
| 123 |
|
| 124 |
+
def cursor_dict(seq_len, samples_consumed, seed, dataset_files_sha=None, step=None):
|
| 125 |
+
"""The whole of the data-position state. Written into every checkpoint, checked on every resume.
|
| 126 |
+
|
| 127 |
+
`step` is recorded alongside `samples_consumed` so the two can be cross-checked on resume: they are
|
| 128 |
+
redundant by construction (samples = step x sequences-per-step), and a cursor where they disagree is a
|
| 129 |
+
corrupted or hand-edited file, not a position to continue from.
|
| 130 |
+
"""
|
| 131 |
+
return {"seq_len": seq_len, "samples_consumed": samples_consumed,
|
| 132 |
+
"tokens_consumed": samples_consumed * seq_len, "shuffle_seed": seed,
|
| 133 |
+
"step": step, "dataset_files_sha": dataset_files_sha}
|
| 134 |
|
| 135 |
|
| 136 |
def load_cursor(dirpath):
|