From 87ba030476cf67691a59dbbf0533c674257fcd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=A6=E6=99=93=E7=8E=B2?= <3174348550@qq.com> Date: Mon, 1 Sep 2025 10:50:14 +0800 Subject: [PATCH] modify contents --- .../advanced_development/accuracy_comparison.md | 12 ++++++------ .../advanced_development/accuracy_comparison.md | 4 ++-- tutorials/source_en/debug/dump.md | 2 +- tutorials/source_zh_cn/debug/dryrun.md | 2 +- tutorials/source_zh_cn/debug/error_analysis.rst | 4 ++-- tutorials/source_zh_cn/debug/profiler.md | 2 +- tutorials/source_zh_cn/debug/sdc.md | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/mindformers/docs/source_en/advanced_development/accuracy_comparison.md b/docs/mindformers/docs/source_en/advanced_development/accuracy_comparison.md index a4f6b47c50..076b1b09b2 100644 --- a/docs/mindformers/docs/source_en/advanced_development/accuracy_comparison.md +++ b/docs/mindformers/docs/source_en/advanced_development/accuracy_comparison.md @@ -14,13 +14,13 @@ This document focuses on the validation of precision consistency at the model le This section describes the recommended basic operating environment for the precision comparison experiment. -### Driver version +### Driver Version | GPU | Version | NPU | Version | |------|------|------|---------| | CUDA | 12.1 | CANN | 8.1.RC1 | -### Important libraries and dependency versions +### Important Libraries and Dependency Versions | GPU | Version | NPU | Version | |--------------------|--------------|------------------------|---------| @@ -31,7 +31,7 @@ This section describes the recommended basic operating environment for the preci | Transformer Engine | 2.1.0 | | | | Apex | 0.1 | | | -### Image links +### Image Links The **GPU/NPU** dependency versions in the preceding tables are for reference only. The actual versions in official images prevail. @@ -68,7 +68,7 @@ The following tables describe the configuration comparison with Megatron-LM. | `group-query-attention` | Specifies whether to enable group query attention. | `use_gqa` | Specifies whether to enable group query attention. | | `num-query-groups` | Number of query groups. | `n_kv_heads` | Number of query groups. | | `max-position-embeddings` | Maximum position encoding length. | `max_position_embeddings` | Maximum position encoding length. | - | `position-embedding-type` | Position encoding type, such as **learned_absolute** and **rope**. | `position_embedding_type` | Position encoding type, such as **learned_absolute** and **rope**. | + | `position-embedding-type` | Position encoding type, such as learned_absolute and rope. | `position_embedding_type` | Position encoding type, such as learned_absolute and rope. | | `use-rotary-position-embeddings` | Specifies whether to use rotary position embedding (RoPE). | Specified by `position_embedding_type`==`rope` | Specifies whether to use RoPE. | | `rotary-base` | Rotary base used for RoPE. | `rotary_base` | Rotary base used for RoPE. | | `rotary-percent` | RoPE usage ratio. | `rotary_percent` | RoPE usage ratio. | @@ -83,9 +83,9 @@ The following tables describe the configuration comparison with Megatron-LM. | `init-method-std` | Standard deviation of the normal distribution used during model parameter initialization. | `init_method_std` | Standard deviation of the normal distribution used during model parameter initialization. | | `attention-dropout` | Dropout probability applied in the multi-head self-attention mechanism. | `attention_dropout` | Dropout probability applied in the multi-head self-attention mechanism. | | `hidden-dropout` | Dropout probability in the hidden layer. | `hidden_dropout` | Dropout probability in the hidden layer. | - | `normalization` | Normalization method, which can be **LayerNorm** or **RMSNorm**. | `normalization` | Normalization method, which can be **LayerNorm** or **RMSNorm**. | + | `normalization` | Normalization method, which can be LayerNorm or RMSNorm. | `normalization` | Normalization method, which can be LayerNorm or RMSNorm. | | `norm-epsilon` | Normalized stability factor (epsilon). | `rms_norm_eps` | RMSNorm stability factor. | - | `apply-layernorm-1p` | Specifies whether to add 1 after **LayerNorm**. | Not supported. | | + | `apply-layernorm-1p` | Specifies whether to add 1 after LayerNorm. | Not supported. | | | `apply-residual-connection-post-layernorm` | Specifies whether the residual connection is applied after LayerNorm. | `apply_residual_connection_post_layernorm` | Specifies whether the residual connection is applied after LayerNorm. | | `openai-gelu` | Specifies whether to use the GELU activation function of the OpenAI version. | Not supported. | | | `squared-relu` | Specifies whether to use the square ReLU activation function. | Not supported. | | diff --git a/docs/mindformers/docs/source_zh_cn/advanced_development/accuracy_comparison.md b/docs/mindformers/docs/source_zh_cn/advanced_development/accuracy_comparison.md index 290f0f7edf..ba5ea03af8 100644 --- a/docs/mindformers/docs/source_zh_cn/advanced_development/accuracy_comparison.md +++ b/docs/mindformers/docs/source_zh_cn/advanced_development/accuracy_comparison.md @@ -6,7 +6,7 @@ 在大模型训练系统中,模型层级的数值精度验证是保障训练稳定性和结果可信度的关键环节。随着训练任务日益复杂,模型结构日趋庞大,确保不同实现之间在模型整体行为上的对齐,显得尤为重要。 -Megatron-LM 是一个面向大规模训练任务的成熟框架,具备高度模块化与良好的可扩展性,广泛应用于高性能训练场景。MindSpore Transformers r1.6.0 版本在模型构建方面架构升级,以**ModuleSpec** 配置方式搭建模型,使得模型结构定义更加**灵活**且**易于复用**,极大提升了开发效率。同时在 NPU 环境下提供了全面优化的训练支持,能够充分发挥 NPU 架构优势。 +Megatron-LM 是一个面向大规模训练任务的成熟框架,具备高度模块化与良好的可扩展性,广泛应用于高性能训练场景。MindSpore Transformers r1.6.0 版本在模型构建方面架构升级,以ModuleSpec配置方式搭建模型,使得模型结构定义更加**灵活**且**易于复用**,极大提升了开发效率。同时在 NPU 环境下提供了全面优化的训练支持,能够充分发挥 NPU 架构优势。 本文档聚焦于两者在模型层面的训练精度一致性验证。通过构建等价的模型结构与配置,使用统一的输入,比较其前向输出、损失值、梯度行为等关键训练过程中的表现差异,以此验证 MindSpore Transformers 在 NPU 环境下实现的可靠性与精度可控性。 @@ -33,7 +33,7 @@ Megatron-LM 是一个面向大规模训练任务的成熟框架,具备高度 ### 镜像链接 -上表中的 **GPU / NPU** 相关依赖版本为参考信息,实际环境请以对应官方镜像为准: +上表中的 **GPU/NPU** 相关依赖版本为参考信息,实际环境请以对应官方镜像为准: - **Megatron-LM**:参考 [Megatron-LM 文档](https://github.com/NVIDIA/Megatron-LM/tree/core_r0.12.0?tab=readme-ov-file#setup) diff --git a/tutorials/source_en/debug/dump.md b/tutorials/source_en/debug/dump.md index 109361a708..b34f7f447b 100644 --- a/tutorials/source_en/debug/dump.md +++ b/tutorials/source_en/debug/dump.md @@ -779,7 +779,7 @@ Generate the numpy.array data. ## Notices - When an operator of type `bfloat16` is saved to the `npy` file, it will be converted to type `float32`. -- Dump only supports saving data with type of bool, int, int8, in16, int32, int64, uint, uint8, uint16, uint32, uint64, float, float16, float32, float64, bfloat16, double, complex64 and complex128. +- Dump only supports saving data with type of bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float, float16, float32, float64, bfloat16, double, complex64 and complex128. - Complex64 and complex128 only support saving as npy files, not as statistics information. - The Print operator has an input parameter with type of string, which is not a data type supported by Dump. Therefore, when the Print operator is included in the script, there will be an error log, which will not affect the saving data of other types. - When Ascend GE dump is enabled, sink size can only be set to 1. User can use [Model.train()](https://www.mindspore.cn/docs/en/master/api_python/train/mindspore.train.Model.html#mindspore.train.Model.train) or [data_sink()](https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.data_sink.html) to set up sink size. diff --git a/tutorials/source_zh_cn/debug/dryrun.md b/tutorials/source_zh_cn/debug/dryrun.md index cac90ebf9b..af6aeca5e0 100644 --- a/tutorials/source_zh_cn/debug/dryrun.md +++ b/tutorials/source_zh_cn/debug/dryrun.md @@ -40,7 +40,7 @@ Actual peak memory usage (with fragments): 26244M 该示例表示: 1. device总内存大小,为65536MB,即64GB。 -2. MindSpore框架当前实际可调用的内存量为59392MB的内存,即约58GB。 +2. MindSpore框架当前实际可调用的内存量为59392MB,即约58GB。 3. MindSpore分配的内存的起始地址为0xffffe9dc1407。 4. MindSpore框架在不考虑内存碎片的情况下,曾经达到的峰值内存使用量为23716M。 5. MindSpore框架在考虑内存碎片的情况下,曾经达到的实际峰值内存使用量为26244M,内存碎片是指由于内存分配和释放导致的内存空间不连续的情况,该值考虑了这些碎片的影响。 diff --git a/tutorials/source_zh_cn/debug/error_analysis.rst b/tutorials/source_zh_cn/debug/error_analysis.rst index 5564386a95..481713ea32 100644 --- a/tutorials/source_zh_cn/debug/error_analysis.rst +++ b/tutorials/source_zh_cn/debug/error_analysis.rst @@ -84,7 +84,7 @@ MindSpore报错信息采用Python Traceback处理,包括Python堆栈信息、 MindSpore网络训练的一般过程是数据加载与处理,网络构建与训练。在分布式并行场景下,还包括分布式并行模式配置。网络报错的错误分析通常包括如下步骤: -1) 根据错误信息,确认是哪种问题场景,如数据加载与处理问题场景、网络构建与训练问题场景或者分布式并行问题场景。通常,可以利用与网络开发者相关的报错信息可进行区分。 +1) 根据错误信息,确认是哪种问题场景,如数据加载与处理问题场景、网络构建与训练问题场景或者分布式并行问题场景。通常,可以利用与网络开发者相关的报错信息进行区分。 2) 分析问题场景,进一步确认是该问题场景下的哪种问题类型。如数据加载与处理问题场景下,包括数据准备问题、数据加载问题与数据增强问题三种类型。通常,需要根据报错中报错类型和报错描述进行区分。 3) 根据Python调用栈以及报错信息,分析发生报错的位置。在动态图模式下,代码报错位置较容易判断。在静态图模式下,需要结合报错信息中“The Traceback of Net Construct Code”部分内容,分析报错位置。 4) 基于可能的报错问题场景以及类型,假设导致报错问题的可能原因。 @@ -151,7 +151,7 @@ MindSpore网络训练的一般过程是数据加载与处理,网络构建与 - 演绎推理策略 - 演绎推理是根据问题推断原因并进一步验证得出结论的过程,MindSpore的报错调试即是根据问题传播的因果链条逐步反向推理,定位问题出的根本原因。例如,MindSpore算子执行报错问题,其直接原因是算子的输入数据含有非法值,而非法值是有前一个算子的计算得出,此时需要分析前一个算子的输入数据和计算过程是否正确。如果前一个算子的计算过程存在问题,即确认了问题范围,如果前一个算子的输入数据也存在非法值,则需要继续分析前面的算子,直到找到问题的根源。 + 演绎推理是根据问题推断原因并进一步验证得出结论的过程,MindSpore的报错调试即是根据问题传播的因果链条逐步反向推理,定位问题的根本原因。例如,MindSpore算子执行报错问题,其直接原因是算子的输入数据含有非法值,而非法值是由前一个算子的计算得出,此时需要分析前一个算子的输入数据和计算过程是否正确。如果前一个算子的计算过程存在问题,即确认了问题范围。如果前一个算子的输入数据也存在非法值,则需要继续分析前面的算子,直到找到问题的根源。 问题复现 ^^^^^^^^ diff --git a/tutorials/source_zh_cn/debug/profiler.md b/tutorials/source_zh_cn/debug/profiler.md index 30f147a729..b31ae6fb12 100644 --- a/tutorials/source_zh_cn/debug/profiler.md +++ b/tutorials/source_zh_cn/debug/profiler.md @@ -481,7 +481,7 @@ HostToDevice的连线通常有两种形态:倾斜和竖直。下图是一个 #### schedule配置错误问题 -schedule配置相关参数有5个:wait、warmup、active、repeat、skip_first。每个参数大小必须**大于等于0**;其中**active**必须**大于等于1**,否则抛出警告,并设置为默认值1;如果repeat设置为0,Profiler会根据模型训练次数来确定repeat值,此时会多生成一个采集不完整的的性能数据,最后一个step的数据用户无需关注,为异常数据。 +schedule配置相关参数有5个:wait、warmup、active、repeat、skip_first。每个参数大小必须**大于等于0**;其中**active**必须**大于等于1**,否则抛出警告,并设置为默认值1;如果repeat设置为0,Profiler会根据模型训练次数来确定repeat值,此时会多生成一个采集不完整的性能数据,最后一个step的数据用户无需关注,为异常数据。 #### schedule与step配置不匹配问题 diff --git a/tutorials/source_zh_cn/debug/sdc.md b/tutorials/source_zh_cn/debug/sdc.md index 6a448f0aa2..6d1a05a08a 100644 --- a/tutorials/source_zh_cn/debug/sdc.md +++ b/tutorials/source_zh_cn/debug/sdc.md @@ -242,7 +242,7 @@ device-0/device-299066_20250225184036913.log:2413:[ERROR] AICPU(26533,aicpu_sche NPU_ASD_ENABLE=2 bash run_silent_check.sh ``` -通过查看 CANN 的 device 日志,默认在 `~/ascend/log/` 目录下,关键 ERROR 日志如下,发现只有一条 ERROR 日志,即检测到异常值是中止了训练: +通过查看 CANN 的 device 日志,默认在 `~/ascend/log/` 目录下,关键 ERROR 日志如下,发现只有一条 ERROR 日志,即检测到异常值时中止了训练: ```bash $ cd ~/ascend/log/debug/ @@ -260,7 +260,7 @@ device-2/device-305322_20250225184310213.log:1859:[ERROR] AICPU(25787,aicpu_sche NPU_ASD_ENABLE=3 bash run_silent_check.sh ``` -通过查看 CANN 的 device 日志,默认在 `~/ascend/log/` 目录下,关键 ERROR 日志如下,发现出了 ERROR 日志之外,还有一些 SilentCheck 的 INFO 日志: +通过查看 CANN 的 device 日志,默认在 `~/ascend/log/` 目录下,关键 ERROR 日志如下,发现除了 ERROR 日志之外,还有一些 SilentCheck 的 INFO 日志: ```bash $ cd ~/ascend/log/debug/ @@ -371,7 +371,7 @@ $ grep -m1 'Global CheckSum result is' worker_0.log * 通过监控NPU健康状态:Health Status显示Warning,Error Code显示80818C00,Error Information显示node type=SoC, sensor type=Check Sensor, event state=check fail; * 通过查看[Ascend Device Plugin](https://github.com/Ascend/ascend-device-plugin)事件,上报错误码80818C00,事件类型为故障事件,故障级别次要。 -当使用联合检测时,若训练中发生特征值特异常、CheckSum检测出静默故障,会在业务训练日志中产生告警: +当使用联合检测时,若训练中发生特征值异常、CheckSum检测出静默故障,会在业务训练日志中产生告警: * 特征值异常日志关键字为“Silent detect strike”; * 触发CheckSum校验日志关键字为“Feature value detection strikes out”; -- Gitee