Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xdoctest][task 232-235] reformat example code with google style in python/paddle/distributed/* #57591

Merged
merged 6 commits into from
Oct 10, 2023

Conversation

jinyouzhi
Copy link
Contributor

@paddle-bot
Copy link

paddle-bot bot commented Sep 21, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Sep 21, 2023
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Sep 21, 2023
from paddle.nn import Linear
from paddle.distributed import fleet
from paddle.distributed.sharding import group_sharded_parallel
>>> # doctest: +REQUIRES(env:distributed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distributed 大写

from paddle.nn import Linear
from paddle.distributed import fleet
from paddle.distributed.sharding import group_sharded_parallel, save_group_sharded_model
>>> # doctest: +REQUIRES(env:distributed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

# this case will use cards {4,5} if your machine hold 8 cards.
if __name__ == '__main__':
dist.spawn(train, args=(True,), nprocs=2, gpus='4,5')
>>> # doctest: +REQUIRES(env:distributed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

trainers=2,
sync_mode=False,
current_endpoint="127.0.0.1:7000")
>>> # doctest: +REQUIRES(env:distributed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大写

@@ -175,13 +175,14 @@ class DistributeTranspilerConfig:
Examples:
.. code-block:: python

from paddle.distributed.transpiler.ps_dispatcher import RoundRobin
import paddle.distributed.transpiler as transpiler
>>> from paddle.distributed.transpiler.ps_dispatcher import RoundRobin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> from paddle.distributed.transpiler.distribute_transpiler import RoundRobin

num_trainers=trainer_num,
trainer_id=trainer_id
)
>>> # doctest: +REQUIRES(env:distributed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大写

... loss_name=avg_loss.name,
... num_trainers=trainer_num,
... trainer_id=trainer_id
>>> )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... 或者把右括号放到上面

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 ... 吧,符合 black 格式化的效果

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

相关示例代码加上 # doctest: +REQUIRES(env:DISTRIBUTED)

Copy link
Contributor

@megemini megemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 CI 是不是重跑一下?aistudio 上 paddle.base.libpaddle.WorkerInfo 没问题 ~

@SigureMo
Copy link
Member

这个 CI 是不是重跑一下?aistudio 上 paddle.base.libpaddle.WorkerInfo 没问题 ~

我看 WorkerInfo 是需要 WITH_RPC 才会 bind 到 libpaddle.so 的,AI Studio 是 WITH_RPC 编的么

@megemini
Copy link
Contributor

我看 WorkerInfo 是需要 WITH_RPC 才会 bind 到 libpaddle.so 的,AI Studio 是 WITH_RPC 编的么

aistudio 是重装官网的 develop 版本


In [20]: paddle.distributed.is_available()
Out[20]: True

应该是可以?~

那这个地方的示例写个 doctest: +REQUIRES(env:DISTRIBUTED)?

@jinyouzhi
Copy link
Contributor Author

@SigureMo @megemini nice dissussion. REQUIRES has been added.
PS:我之前本地试能跑通所以没加

Copy link
Contributor

@megemini megemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jinyouzhi 修改一下 >>> # doctest: +REQUIRES(env:distributed) 大小写 ~

... pserver_program = t.get_pserver_program(current_endpoint)
... pserver_startup_program = t.get_startup_program(current_endpoint,
... pserver_program)
>>> elif role == "TRAINER":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elif 是复合语句的一部分,用 ... 代替 >>> 吧 ~

@jinyouzhi jinyouzhi requested a review from megemini September 28, 2023 16:09
Copy link
Contributor

@megemini megemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LSTM ~

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Oct 6, 2023

Sorry to inform you that 62691e1's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@luotao1
Copy link
Contributor

luotao1 commented Oct 9, 2023

@jinyouzhi 辛苦merge下最新的develop

@jinyouzhi
Copy link
Contributor Author

@jinyouzhi 辛苦merge下最新的develop

Done

@luotao1 luotao1 merged commit 36bc339 into PaddlePaddle:develop Oct 10, 2023
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
…python/paddle/distributed/*` (PaddlePaddle#57591)

* [Doctest]fix No.232-235, test=docs_preview

* fix format

* add requires for rpc

* fix typo

* fix some

* fix upcase
jiahy0825 pushed a commit to jiahy0825/Paddle that referenced this pull request Oct 16, 2023
…python/paddle/distributed/*` (PaddlePaddle#57591)

* [Doctest]fix No.232-235, test=docs_preview

* fix format

* add requires for rpc

* fix typo

* fix some

* fix upcase
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…python/paddle/distributed/*` (PaddlePaddle#57591)

* [Doctest]fix No.232-235, test=docs_preview

* fix format

* add requires for rpc

* fix typo

* fix some

* fix upcase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants