-
Notifications
You must be signed in to change notification settings - Fork 766
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
【映射文档自动化】 添加 PyTorch 与 Paddle 映射关系主目录的自动生成 #6256
【映射文档自动化】 添加 PyTorch 与 Paddle 映射关系主目录的自动生成 #6256
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6256.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
01e4304
to
37e3761
Compare
e79115f
to
b476058
Compare
docs/guides/model_convert/convert_from_pytorch/api_mappings.json
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/apply_reference_from_api_difference.py
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.diag_embed.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.nansum.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.Dataset.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/apply_reference_from_api_difference.py
Outdated
Show resolved
Hide resolved
@@ -1,15 +1,15 @@ | |||
# PyTorch 1.13 与 Paddle 2.4 API 映射表 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个改成Pytorch 2.1.0,Paddle develop 吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更新
|
||
## 贡献代码 | ||
本文档梳理了 PyTorch(v1.13)常用 API 与 PaddlePaddle 2.4.0 API 对应关系与差异分析。通过本文档,帮助开发者快速迁移 PyTorch 使用经验,完成模型的开发与调优。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本文梳理了 Pytorch最新发行版(当前v2.1.0)API与PaddlePaddle develop版本API 对应关系与差异分析。通过本文档,帮助开发者快速迁移 PyTorch 使用经验,完成模型的开发与调优。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更新
docs/guides/model_convert/convert_from_pytorch/validate_mapping_in_api_difference.py
Outdated
Show resolved
Hide resolved
ci_scripts/hooks/pre-doc-compile.sh
Outdated
DOCROOT=${FLUIDDOCDIR}/docs/ | ||
|
||
|
||
APIMAPPING_ROOT=${DOCROOT}/guides/model_convert/convert_from_pytorch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这几个变量不可以直接写在第三步里吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 关于能否删除这几个变量
这几个变量是因为其他脚本统一采用这一系列变量作为 docs 根目录来处理,考虑之后的脚本间同步问题,所以用了这几个变量 - 关于变量定义位置
已经将APIMAPPING_ROOT
移动到第三步中,其余两个变量因为可能会其他步骤用到,所以继续留在开头
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,后续注意观察效果
好的了解,目前仍然有两个问题:
|
添加了映射主目录的表单自动生成脚本 apply_reference_from_api_difference.py,根据 api_difference/ 目录下的映射文档,提取其映射的元数据,更新到映射目录中。
同时,将元数据保存,得到
api_mappings.json
,用于后续PaConvert
与文档部分的对齐。尚未添加对映射文档合法性检查的规则。
当前仍有 10 个表单项(存量)来自手动维护,由于尚无这部分映射文档,对于手动维护内容,目前进行跳过不处理。
主目录映射记法:
REFERENCE-MAPPING-ITEM(<torch_api>, <mapping_document_url>)
NOT-IMPLEMENTED-ITEM(<torch_api>, <torch_api_url>)
功能描述:
<torch_api>
支持反引号记法 (`torch.XX`
)、\_
记法 (torch.manual\_seed
)等,后续查找时会对不同记法进行统一处理,来确保匹配正确REFERENCE-MAPPING-ITEM
,根据其实际对应的 api 名称,到api_difference
目录中查找名称符合<torch_api>.md
的映射文档,并从中提取torch_api_url, paddle_api, paddle_api_url, 映射类型 mapping_type
这些元信息,用于映射目录生成。NOT-IMPLEMENTED-ITEM
不进行映射文档查找,直接将该项作为 “功能缺失” 类别。生成结果(源文件)预览见
页面预览见
本 PR 中含有部分映射文档更新,单独 PR 于
映射文档 添加部分缺失的映射文档 #6252
注:待 映射文档 添加部分缺失的映射文档 #6252 合入后,再合入本文档
@SigureMo @zhwesky2010