Commit 79cdcf4
authored
Add OPSD (On-Policy Distillation) training example (#1002)
* Add OPSD (On-Policy Distillation) training example
Entry point, configs, data, and tests for on-policy distillation
using DeepSpeed's hybrid engine rollout and vLLM backend.
Signed-off-by: Guokai Ma <guokai.ma@intel.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Use ROLLOUT_VISIBLE_DEVICE env var for vLLM GPU placement; rename vllm_dtype to engine_dtype
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Remove vLLM path, absorb trainer/config/losses/utils/benchmarks from DeepSpeed
- Delete vLLM configs, scripts (opsd_vllm_disjoint.json, smoke_vllm.json, train_opsd_vllm.sh)
- Add trainer.py, config.py, losses.py, utils.py (moved from DeepSpeed)
- Add benchmarks/ (5 hybrid engine benchmarks moved from DeepSpeed)
- Update main.py imports (trainer, config now local)
- Update test imports (losses, utils now local)
- Rewrite README (remove all vLLM sections)
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Move teacher.py and data.py from DeepSpeed to DeepSpeedExamples
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Extend RolloutConfig with app-level generation knobs; clean vLLM remnants from JSON
- Subclass DeepSpeed's RolloutConfig to add temperature/top_p/etc
- Remove weight_sync_interval from JSON configs (vLLM remnant)
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Keep only bench_decode_1p1r; add --graph-capture flag and engine wrapper fix
- Remove 14B/multi-GPU benchmarks (bench_14b_rollout, bench_autotp_gc,
bench_hybrid_tp, bench_hybrid_tp_opt)
- Fix bench_decode_1p1r: wrap model for HybridEngineRollout
- Add --graph-capture CLI flag
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Fix distillation temperature from 0 to 1.0 in smoke and production configs
temperature=0 causes logits/0 = inf → NaN loss. The correct default
for knowledge distillation is temperature=1.0 (standard softmax).
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Fix trailing commas in JSON configs; remove unused smoke_ds_zero3.json
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Remove leftover vLLM comment references from OPSD example
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Fix OPSD README layout to match actual DSE directory structure
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Gather TP-sharded logits to full vocab for teacher and student; no-op at TP=1 / under ZeRO-3
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Replace Microsoft copyright headers with DeepSpeed Team across OPSD example
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Use SPDX + DeepSpeed Team license header for OPSD files
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Use transformers 5.0+ dtype kwarg; require transformers>=5.0.0
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Remove TP vocab-gather scaffolding; defer TP support to a later PR
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Shard data across ranks via DistributedSampler for real data parallelism
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Always route teacher through DeepSpeed ZeRO-3; offload opt-in (resolves review)
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Pick teacher ZeRO stage by world size: stage 3 only when sharding/offloading, else stage 0
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Document that DeepSpeed must be installed from master until 0.19.3 release
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Derive train_batch_size from micro*world*grad_accum; drop it as a config knob
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Let DeepSpeed auto-derive train_batch_size instead of computing it explicitly
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Drop redundant train_batch_size omission comment
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Remove unused per_token_logprobs helper and its test
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Add CPU tests for LeftPaddedPromptCollator and PromptDataset
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
* Remove unused shift_for_next_token_prediction helper and its test
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
---------
Signed-off-by: Guokai Ma <guokai.ma@intel.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>1 parent 6eb2582 commit 79cdcf4
20 files changed
Lines changed: 2082 additions & 0 deletions
File tree
- training/opsd
- benchmarks
- configs
- data
- scripts
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 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 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
0 commit comments