You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source_en/Megatron-SWIFT/Ascend.md
+132Lines changed: 132 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,3 +41,135 @@ while iteration < args.train_iters:
41
41
...
42
42
prof.stop()
43
43
```
44
+
45
+
# NPU Accuracy Data Collection
46
+
### Configuration
47
+
48
+
Modify the dump_path, level and other configuration items in the msprobe_config.json file under the ms-swift directory as needed.
49
+
More configurations can be found in [Configuration Examples](https://gitcode.com/Ascend/mstt/blob/master/debug/accuracy_tools/msprobe/docs/zh/dump/config_json_examples.md) and [Configuration File Introduction](https://gitcode.com/Ascend/mstt/blob/master/debug/accuracy_tools/msprobe/docs/zh/dump/config_json_introduct.md)
50
+
51
+
52
+
### Code Modification
53
+
To support accuracy debugging with the msprobe tool, we need to modify the `_patch_word_embeddings` function in the `swift/megatron/model/mm_gpt_model.py` file. The main changes are to adjust the function parameters and internal implementation logic so that it can correctly patch the embedding layer.
1. The `_patch_word_embeddings` method adds an `emb` parameter to receive the embedding module instance
147
+
2. Directly obtain `emb.word_embeddings.forward` instead of `VocabParallelEmbedding.forward`
148
+
3. The internal `forward` function signature changed from `(_self, input_)` to `(input_)`
149
+
4. Get `_self` through `emb.word_embeddings` inside the function
150
+
5. Pass `input_` directly when calling the original forward
151
+
6. Use `emb.word_embeddings.forward` for replacement and recovery operations (Modifications 6, 7)
152
+
7. Pass the `self.language_model.embedding` instance when calling `_patch_word_embeddings`
153
+
154
+
155
+
### Enablement
156
+
Add `--enable_msprobe True` to the startup script
157
+
158
+
In addition, since msprobe does not support fused computation, you also need to add `--no_bias_dropout_fusion True`, `--no_bias_swiglu_fusion True`, `--cross_entropy_loss_fusion False`
0 commit comments