From 47066c48a7ebda0d36c16de7425c364b79b8f520 Mon Sep 17 00:00:00 2001 From: co63oc Date: Wed, 1 Nov 2023 08:40:33 +0800 Subject: [PATCH 1/5] Add api_difference docs --- .../torch.distributed.all_gather.md | 14 ++++++------- .../torch.distributed.all_reduce.md | 2 +- .../torch.distributed.get_backend.md | 21 +++++++++++++++++++ .../pytorch_api_mapping_cn.md | 1 + 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.get_backend.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md index a351af40494..3126f244a5a 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md @@ -9,16 +9,16 @@ torch.distributed.all_gather(tensor_list, tensor, group=None, async_op=False) ### [paddle.distributed.all_gather](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/all_gather_cn.html) ```python -paddle.distributed.all_gather(tensor_list, tensor, group=0) +paddle.distributed.all_gather(tensor_list, tensor, group=0, sync_op=True) ``` Pytorch 相比 Paddle 支持更多其他参数,具体如下: ### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -| ----------- | ------------ | --------------------------------------------- | -| tensor_list | tensor_list | 操作的输出 Tensor 列表。 | -| tensor | tensor | 操作的输入 Tensor。 | -| group | group | 工作的进程组编号。 | -| async_op | - | 是否异步操作,Paddle 无此参数,暂无转写方式。 | +| PyTorch | PaddlePaddle | 备注 | +| ----------- | ------------ | --------------------------------------------------------------- | +| tensor_list | tensor_list | 操作的输出 Tensor 列表。 | +| tensor | tensor | 操作的输入 Tensor。 | +| group | group | 工作的进程组编号。 | +| async_op | sync_op | torch 为是否异步操作,Paddle 为是否同步操作,转写方式取反即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md index 5d73c6de5af..efc0dfc20ee 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md @@ -9,7 +9,7 @@ torch.distributed.all_reduce(tensor, op= Date: Wed, 1 Nov 2023 16:55:23 +0800 Subject: [PATCH 2/5] Fix --- .../model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index c4dbf078d9b..d05983688dd 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -1115,7 +1115,6 @@ |31|[torch.distributed.scatter](https://pytorch.org/docs/stable/distributed.html#torch.distributed.scatter)|[paddle.distributed.scatter](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/scatter_cn.html)|torch 参数更多, [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter.md)| |32|[torch.distributed.scatter_object_list](https://pytorch.org/docs/stable/distributed.html#torch.distributed.scatter_object_list)|[paddle.distributed.scatter_object_list](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/scatter_object_list_cn.html#scatter-object-list)|仅参数名不一致, [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter_object_list.md)| |33|[torch.distributed.send](https://pytorch.org/docs/stable/distributed.html#torch.distributed.send)|[paddle.distributed.send](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/send_cn.html)|torch 参数更多, [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.send.md)| -|34|[torch.distributed.gather](https://pytorch.org/docs/stable/distributed.html#torch.distributed.gather)| | 功能缺失 | ***持续更新...*** From b233a19c780e14c8f89085dbf9244ce1c0af2468 Mon Sep 17 00:00:00 2001 From: co63oc Date: Wed, 1 Nov 2023 16:56:46 +0800 Subject: [PATCH 3/5] Fix --- .../model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index 73ac51a543b..cbc5cf3523a 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -1116,6 +1116,7 @@ | REFERENCE-MAPPING-ITEM(`torch.distributed.scatter`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter.md) | | REFERENCE-MAPPING-ITEM(`torch.distributed.scatter_object_list`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter_object_list.md) | | REFERENCE-MAPPING-ITEM(`torch.distributed.send`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.send.md) | +| [torch.distributed.gather](https://pytorch.org/docs/stable/distributed.html#torch.distributed.gather) | 功能缺失 | ***持续更新...*** From afc2b755a24cb6bc127d873dcef64cd6655f476b Mon Sep 17 00:00:00 2001 From: co63oc Date: Wed, 1 Nov 2023 17:23:45 +0800 Subject: [PATCH 4/5] Fix --- .../distributed/torch.distributed.gather.md | 25 +++++++++++++++++++ .../pytorch_api_mapping_cn.md | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.gather.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.gather.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.gather.md new file mode 100644 index 00000000000..4aaf7ff37e7 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.gather.md @@ -0,0 +1,25 @@ +## [torch 参数更多]torch.distributed.gather + +### [torch.distributed.gather](https://pytorch.org/docs/stable/distributed.html#torch.distributed.gather) + +```python +torch.distributed.gather(tensor, gather_list=None, dst=0, group=None, async_op=False) +``` + +### [paddle.distributed.gather](https://github.com/PaddlePaddle/Paddle/blob/c8ccc9b154632ef41ade1b8e97b87d54fde7e8f8/python/paddle/distributed/communication/gather.py#L20C71-L20C71) + +```python +paddle.distributed.gather(tensor, gather_list=None, dst=0, group=None, sync_op=True) +``` + +Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ----------- | ------------ | --------------------------------------------------------------- | +| tensor | tensor | 操作的输入 Tensor。 | +| gather_list | gather_list | 操作的输出 Tensor 列表。 | +| dst | dst | 表示目标进程的 rank。 | +| group | group | 工作的进程组编号。 | +| async_op | sync_op | torch 为是否异步操作,Paddle 为是否同步操作,转写方式取反即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index cbc5cf3523a..73ac51a543b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -1116,7 +1116,6 @@ | REFERENCE-MAPPING-ITEM(`torch.distributed.scatter`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter.md) | | REFERENCE-MAPPING-ITEM(`torch.distributed.scatter_object_list`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.scatter_object_list.md) | | REFERENCE-MAPPING-ITEM(`torch.distributed.send`, https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.send.md) | -| [torch.distributed.gather](https://pytorch.org/docs/stable/distributed.html#torch.distributed.gather) | 功能缺失 | ***持续更新...*** From 2dd30e70978c1be272e7e57749d3bc66b50c40f6 Mon Sep 17 00:00:00 2001 From: co63oc Date: Fri, 3 Nov 2023 19:32:12 +0800 Subject: [PATCH 5/5] Fix --- .../torch.distributed.all_gather.md | 6 +++--- .../torch.distributed.all_reduce.md | 16 +++++++-------- .../torch.distributed.all_to_all.md | 19 +++++++++--------- .../distributed/torch.distributed.barrier.md | 2 +- .../torch.distributed.broadcast.md | 8 ++++---- .../distributed/torch.distributed.gather.md | 4 ++-- .../distributed/torch.distributed.scatter.md | 20 +++++++++---------- 7 files changed, 37 insertions(+), 38 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md index 3126f244a5a..1d996856a17 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_gather.md @@ -1,4 +1,4 @@ -## [torch 参数更多]torch.distributed.all_gather +## [参数不一致]torch.distributed.all_gather ### [torch.distributed.all_gather](https://pytorch.org/docs/stable/distributed.html#torch.distributed.all_gather) @@ -9,10 +9,10 @@ torch.distributed.all_gather(tensor_list, tensor, group=None, async_op=False) ### [paddle.distributed.all_gather](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/all_gather_cn.html) ```python -paddle.distributed.all_gather(tensor_list, tensor, group=0, sync_op=True) +paddle.distributed.all_gather(tensor_list, tensor, group=None, sync_op=True) ``` -Pytorch 相比 Paddle 支持更多其他参数,具体如下: +其中 PyTorch 和 Paddle 功能一致,参数用法不一致,具体如下: ### 参数映射 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md index efc0dfc20ee..254719c11bf 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.all_reduce.md @@ -1,4 +1,4 @@ -## [torch 参数更多]torch.distributed.all_reduce +## [参数不一致]torch.distributed.all_reduce ### [torch.distributed.all_reduce](https://pytorch.org/docs/stable/distributed.html#torch.distributed.all_reduce) @@ -9,16 +9,16 @@ torch.distributed.all_reduce(tensor, op=