Skip to content

[Typing][C-12] Add type annotations for python/paddle/distributed/communication/all_gather.py #66051

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

Merged
merged 6 commits into from
Jul 20, 2024

Conversation

megemini
Copy link
Contributor

PR Category

User Experience

PR Types

Improvements

Description

类型标注:

  • python/paddle/distributed/communication/all_gather.py

Related links

@SigureMo @megemini

Copy link

paddle-bot bot commented Jul 15, 2024

你的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 Jul 15, 2024
@megemini
Copy link
Contributor Author

megemini commented Jul 15, 2024

补充:

是否可以在 _typing 中引入 _libpaddle.pyi 文件?

标注 distributed 的时候,发现有很多是直接使用 c++ 绑定到 paddle.base.libpaddle 中的类 ~ 之前也遇到过 ~

是否可以引入此文件,将需要用到的 paddle.base.libpaddle 放到 _libpaddle.pyi 中,并作为 Protocol?

@megemini
Copy link
Contributor Author

Update 20240716

paddle.base.libpaddlepaddle.base.core 貌似是等价的 ~

尝试去掉 _typing._libpaddle ,在 paddle.base.core.pyi 中增加 ~

@megemini
Copy link
Contributor Author

megemini commented Jul 16, 2024

在考虑,要不要搞个 core.prototype.pyi ...

p.s. 有个问题是,libpaddle 里面的东西是跟随编译环境生成的,比如 DistFleetWrapper ,需要分布式编译选项才有,因此,如果只是根据 libpaddle 内容生成 stub,东西可能不全 ... ...

@SigureMo
Copy link
Member

在考虑,要不要搞个 core.prototype.pyi ...

可以呀

p.s. 有个问题是,libpaddle 里面的东西是跟随编译环境生成的,比如 DistFleetWrapper ,需要分布式编译选项才有,因此,如果只是根据 libpaddle 内容生成 stub,东西可能不全 ... ...

如果用户在用开分布式选项的包,那么就一定会有这个 stub,如果用的是没有编分布式的包,那么运行时也不会访问,没有也没什么关系

如果是 CI 检查的话,可以考虑整个 Any 啥的 Fallback 机制吧,感觉也没啥更好的办法

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.

LGTMeow 🐾

@SigureMo SigureMo merged commit 642eefe into PaddlePaddle:develop Jul 20, 2024
31 checks passed
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants