Upload slimshard.py
Browse files- slimshard.py +9 -0
slimshard.py
CHANGED
|
@@ -1546,6 +1546,15 @@ def _write_lm_head_calibrated_chunked(
|
|
| 1546 |
seqs_to_run.append(chat_seq[:-1])
|
| 1547 |
start_pos = len(chat_pref_ids) - 1
|
| 1548 |
seq_transition_slices.append((start_pos, chat_rep_ids))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1549 |
|
| 1550 |
bg_seq = [int(x) for x in np.linspace(100, min(max(vocab - 1, 100), 20000), 16, dtype=np.int64)]
|
| 1551 |
seqs_to_run.append(bg_seq)
|
|
|
|
| 1546 |
seqs_to_run.append(chat_seq[:-1])
|
| 1547 |
start_pos = len(chat_pref_ids) - 1
|
| 1548 |
seq_transition_slices.append((start_pos, chat_rep_ids))
|
| 1549 |
+
elif tok_id("<|User|>") >= 0 and len(chat_rep_ids) >= 2:
|
| 1550 |
+
ds_pref = [0, 128799] + tok_piece_ids(
|
| 1551 |
+
["Reasoning", " Effort", ":", " ", "7", "5", " (", "range", " ", "1", "-", "1", "0", "0", ",", " the", " higher", " the", " value", ",", " the", " more", " thorough", " the", " reasoning", ")\n\n"]
|
| 1552 |
+
) + [tok_id("<|User|>")] + tok_piece_ids(["hello"]) + [tok_id("<|Assistant|>"), tok_id("<think>")]
|
| 1553 |
+
ds_rep = ([tok_id("</think>")] if tok_id("</think>") >= 0 else []) + chat_rep_ids
|
| 1554 |
+
if all(x >= 0 for x in ds_pref):
|
| 1555 |
+
ds_seq = ds_pref + ds_rep
|
| 1556 |
+
seqs_to_run.append(ds_seq[:-1])
|
| 1557 |
+
seq_transition_slices.append((len(ds_pref) - 1, ds_rep))
|
| 1558 |
|
| 1559 |
bg_seq = [int(x) for x in np.linspace(100, min(max(vocab - 1, 100), 20000), 16, dtype=np.int64)]
|
| 1560 |
seqs_to_run.append(bg_seq)
|