Merged
docs: update documents #7686
Rose_is_rosierAdd on Aug 27
docs: update documents #7686
Merged
Total: 19 files changed+62-57
MPyTorch/docs/en/mixed_precision_adaptation/adaptation_introduction.md+1-1File content is under review, please try again later
MPyTorch/docs/en/model_migration/manual_migration.md+14-2File content is under review, please try again later
MPyTorch/docs/en/model_migration/tool_migration.md+1-1File content is under review, please try again later
MPyTorch/docs/en/model_training/model_debug.md+3-3File content is under review, please try again later
MPyTorch/docs/en/model_training/training_execution.md+2-7File content is under review, please try again later
MPyTorch/docs/en/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/FlashAttentionScore.md+6-7File content is under review, please try again later
MPyTorch/docs/en/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/RmsNorm-RmsNormGrad.md+0-4File content is under review, please try again later
MPyTorch/docs/en/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/RotaryMul-RotaryMulGrad.md+1-1File content is under review, please try again later
MPyTorch/docs/en/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/ScaledMaskedSoftmax-ScaledMaskedSoftmaxGrad.md+1-1File content is under review, please try again later
MPyTorch/docs/zh/mixed_precision_adaptation/adaptation_introduction.md+1-1File content is under review, please try again later
| @@ -98,12 +98,24 @@ | |||
| 98 | 98 | ||
| 99 | ```python | 99 | ```python |
| 100 | import torch.distributed as dist | 100 | import torch.distributed as dist |
| 101 | -dist.init_process_group(backend='nccl',init_method="tcp://127.0.0.1:**", ...... ,rank=args.rank) # **为端口号,根据实际选择一个闲置端口填写 | 101 | +dist.init_process_group( |
| 102 | + backend="nccl", | ||
| 103 | + init_method="tcp://127.0.0.1:29500", | ||
| 104 | + world_size=args.world_size, | ||
| 105 | + rank=args.rank, | ||
| 106 | +) | ||
| 102 | ``` | 107 | ``` |
| 103 | 108 | ||
| 104 | 修改后,NPU使用hccl方式: | 109 | 修改后,NPU使用hccl方式: |
| 105 | 110 | ||
| 106 | ```python | 111 | ```python |
| 107 | import torch.distributed as dist | 112 | import torch.distributed as dist |
| 108 | -dist.init_process_group(backend='hccl',init_method="tcp://127.0.0.1:**", ...... ,rank=args.rank) # **为端口号,根据实际选择一个闲置端口填写 | 113 | +dist.init_process_group( |
| 114 | + backend="hccl", | ||
| 115 | + init_method="tcp://127.0.0.1:29500", | ||
| 116 | + world_size=args.world_size, | ||
| 117 | + rank=args.rank, | ||
| 118 | +) | ||
| 109 | ``` | 119 | ``` |
| 120 | + | ||
| 121 | +其中,29500为示例端口号,请根据实际情况选择一个空闲端口。 | ||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | > [!NOTE] | 7 | > [!NOTE] |
| 8 | > | 8 | > |
| 9 | -> - 若用户训练脚本中包含NPU平台不支持的**amp\_C**模块,需要用户手动删除后再进行训练。 | 9 | +> - 若用户训练脚本中包含NPU平台不支持的`amp_C`模块,需要用户手动删除后再进行训练。 |
| 10 | > - 由于转换后的脚本与原始脚本平台不一致,迁移后的脚本在调试运行过程中可能会由于算子差异等原因而抛出异常,导致进程终止,该类异常需要用户根据异常信息进一步调试解决。 | 10 | > - 由于转换后的脚本与原始脚本平台不一致,迁移后的脚本在调试运行过程中可能会由于算子差异等原因而抛出异常,导致进程终止,该类异常需要用户根据异常信息进一步调试解决。 |
| 11 | 11 | ||
| 12 | ## 使用方法 | 12 | ## 使用方法 |
| @@ -15,12 +15,12 @@ | |||
| 15 | 15 | ||
| 16 | 1. 环境准备。 | 16 | 1. 环境准备。 |
| 17 | 1. 安装开发套件Ascend-cann-toolkit。请参见[《CANN 快速安装》](https://www.hiascend.com/cann/download)。 | 17 | 1. 安装开发套件Ascend-cann-toolkit。请参见[《CANN 快速安装》](https://www.hiascend.com/cann/download)。 |
| 18 | - 2. 须安装如下依赖(以root用户安装为例,非root用户需加--user参数)。 | 18 | + 2. 须安装如下依赖(以root用户安装为例,非root用户需加`--user`参数)。 |
| 19 | 19 | ||
| 20 | ```shell | 20 | ```shell |
| 21 | pip3 install pandas # pandas版本号需大于或等于1.2.4 | 21 | pip3 install pandas # pandas版本号需大于或等于1.2.4 |
| 22 | pip3 install libcst # Python语法树解析器,用于解析Python文件 | 22 | pip3 install libcst # Python语法树解析器,用于解析Python文件 |
| 23 | - pip3 install prettytable # 将数据可视化为图表形式 | 23 | + pip3 install prettytable # 以格式化表格形式展示数据 |
| 24 | pip3 install jedi # 用于跨文件解析,建议安装 | 24 | pip3 install jedi # 用于跨文件解析,建议安装 |
| 25 | ``` | 25 | ``` |
| 26 | 26 | ||
| @@ -61,7 +61,7 @@ gdb调试工具的主要功能为在程序中设置断点、监视变量、单 | |||
| 61 | # 临时修改生成的core dump文件的名称,变量占位符可自行设置 | 61 | # 临时修改生成的core dump文件的名称,变量占位符可自行设置 |
| 62 | sysctl -w kernel.core_pattern=core-%e.%p.%h.%t | 62 | sysctl -w kernel.core_pattern=core-%e.%p.%h.%t |
| 63 | # 设置core dump生成目录,变量占位符和生成目录可自行设置 | 63 | # 设置core dump生成目录,变量占位符和生成目录可自行设置 |
| 64 | - echo "/pathtocore dump/core.%e.%p" >/proc/sys/kernel/core_pattern | 64 | + echo "/path/to/core/dump/core.%e.%p" >/proc/sys/kernel/core_pattern |
| 65 | ``` | 65 | ``` |
| 66 | 66 | ||
| 67 | 可以在core.pattern模板中使用的变量见表1。 | 67 | 可以在core.pattern模板中使用的变量见表1。 |
| @@ -81,7 +81,7 @@ gdb调试工具的主要功能为在程序中设置断点、监视变量、单 | |||
| 81 | 81 | ||
| 82 | 4. 生成core dump文件。 | 82 | 4. 生成core dump文件。 |
| 83 | 83 | ||
| 84 | - 运行模型脚本,若模型报错、进程崩溃,即可在当前目录下生成core dump文件。 | 84 | + 运行模型脚本,若模型报错、进程崩溃,即可在配置的目录下生成core dump文件。 |
| 85 | 85 | ||
| 86 | 5. 调试core dump文件。 | 86 | 5. 调试core dump文件。 |
| 87 | 87 | ||
| @@ -133,7 +133,7 @@ def hook_func(name, module): | |||
| 133 | for name, module in model.named_modules(): | 133 | for name, module in model.named_modules(): |
| 134 | if module is not None: | 134 | if module is not None: |
| 135 | module.register_forward_hook(hook_func('[forward]:' + name, module)) | 135 | module.register_forward_hook(hook_func('[forward]:' + name, module)) |
| 136 | - module.register_backward_hook(hook_func('[backward]:' + name, module)) | 136 | + module.register_full_backward_hook(hook_func('[backward]:' + name, module)) |
| 137 | ``` | 137 | ``` |
| 138 | 138 | ||
| 139 | 下图展示了添加hook函数后的日志打印内容,可以看到模型的每个模块名被打印出来,用户也可以通过修改hook\_func函数,自定义想打印的内容。 | 139 | 下图展示了添加hook函数后的日志打印内容,可以看到模型的每个模块名被打印出来,用户也可以通过修改hook\_func函数,自定义想打印的内容。 |
MPyTorch/docs/zh/model_training/training_execution.md+2-7File content is under review, please try again later
MPyTorch/docs/zh/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/FlashAttentionScore.md+6-6File content is under review, please try again later
MPyTorch/docs/zh/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/RmsNorm-RmsNormGrad.md+0-4File content is under review, please try again later
MPyTorch/docs/zh/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/RotaryMul-RotaryMulGrad.md+1-1File content is under review, please try again later
MPyTorch/docs/zh/performance_tuning/performance_tuning_methods/npu_affinity_opt/fusion_op_repl/ScaledMaskedSoftmax-ScaledMaskedSoftmaxGrad.md+1-1File content is under review, please try again later