Download source/src/speculators/models/mtp/data.py from khazic/spec-b300: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/khazic/spec-b300/resolve/main/source/src/speculators/models/mtp/data.py
- Command line
-
hf download hf://khazic/spec-b300/source/src/speculators/models/mtp/data.py
-
curl -L -o data.py https://huggingface.co/khazic/spec-b300/resolve/main/source/src/speculators/models/mtp/data.py
583 Bytes
| from speculators.train.data import BatchType | |
| __all__ = ["shift_batch_mtp"] | |
| def shift_batch_mtp(batch: BatchType) -> BatchType: | |
| """Rename verifier_last_hidden_states to hidden_states for MTP. | |
| No token-level shifting — the MTP forward pass handles alignment | |
| internally via per-step offset slicing of input_ids. | |
| """ | |
| return { | |
| "input_ids": batch["input_ids"], | |
| "hidden_states": batch["verifier_last_hidden_states"], | |
| "loss_mask": batch["loss_mask"], | |
| "lengths": batch["lengths"], | |
| "position_ids": batch["position_ids"], | |
| } | |