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

Support PT in paddle2onnx #1481

Merged
merged 22 commits into from
Feb 20, 2025

Conversation

risemeup1
Copy link
Collaborator

@risemeup1 risemeup1 commented Jan 20, 2025

  1. 使用PT将旧IR转换成新IR,用户传的是infernece.pdmodel和inference.pdiparams,先转换成json格式,然后再走新IR下转ONNX逻辑,便于后续维护
  2. 支持多个算子转换
  3. 修复控制流算子bug

@risemeup1 risemeup1 force-pushed the support_program_translator branch from 35cd933 to a24dee7 Compare January 22, 2025 05:07
@risemeup1 risemeup1 closed this Feb 7, 2025
@risemeup1 risemeup1 force-pushed the support_program_translator branch from 5af9855 to 9071329 Compare February 7, 2025 11:16
@risemeup1 risemeup1 reopened this Feb 7, 2025
@risemeup1 risemeup1 force-pushed the support_program_translator branch from 1272ed8 to 45eef56 Compare February 18, 2025 07:53
GetAttr("strides", &strides_);
GetAttr("paddings", &pads_);
GetAttr("ksize", &k_size_);
if (OpType() != "max_pool3d_with_index") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

改成convert_pir_op_name(OpType())

else
{
std::cout<<"dtype: "<<dtype;
Copy link
Collaborator

Choose a reason for hiding this comment

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

删除这里的打印,Assert提示中增加uint8

void BuiltinSliceMapper::Opset7() {
auto input_info = GetInput(0);
auto output_info = GetOutput(0);
if (HasAttr("index")) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

index不存在的情况有吗?默认值是什么?

GaussianRandomMapper(const PaddlePirParser& p, OnnxHelper* helper, int64_t i,
bool c)
: Mapper(p, helper, i, c) {
in_pir_mode = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以删除
in_pir_mode = true;
// GetAttr("shape", &shape_);

// print_stream << "ForwardProgram is :\n";
// pir_program_->Print(print_stream);
// std::cout << "Program (fwd | bwd): \n" << print_stream.str() <<
// std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

删除注释

if (op->name() == "pd_op.data" || op->name() == "pd_op.feed"){
std::string var_name = GenOpInputOutputName(op->name());
// std::string var_name = op->attribute<pir::StrAttribute>("name").AsString();
// inputs.push_back(GetTensorInfo(var_name, op->result(0).type()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

删除注释

tests/run.sh Outdated
test_auto_scan_dist.py \
test_auto_scan_distribute_fpn_proposals1.py \
test_auto_scan_distribute_fpn_proposals_v2.py \
test_auto_scan_fill_constant_batch_size_like.py \
test_auto_scan_gaussian_random \
Copy link
Collaborator

Choose a reason for hiding this comment

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

写错了,而且和38行重复了

Copy link
Collaborator

Choose a reason for hiding this comment

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

添加@_test_with_pir

Copy link
Collaborator

Choose a reason for hiding this comment

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

添加@_test_with_pir

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个单测为什么不测PT?

@0x3878f
Copy link
Collaborator

0x3878f commented Feb 19, 2025

  • 其他建议:

    • pir_parser.cconnxbase.py 中修改输出输出变量名称相关的逻辑单独提一个PR做好记录
  • PT的PR合入后需要做的:

    1. 检查run.sh/run.bat中忽略的单测,理论上增加PT后所有的单测都应该通过
    2. 检查已经支持的算子是否都存在对应的单测

@risemeup1 risemeup1 merged commit 4ac9f69 into PaddlePaddle:develop Feb 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants