Skip to content

export_model.py 导出ppyoloe_plus model 始终报错(必现) #9428

@developerlin

Description

@developerlin

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Export

Bug描述 Describe the Bug

无论是导出训练的模型还是foundation model都报同样的错:

TypeError: In transformed code:

    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
        if self.training:
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 69, in forward
        for inp in inputs_list:
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 76, in forward
        outs.append(self.get_pred())
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 150, in get_pred
        return self._forward()
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 92, in _forward
        if self.training:
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 101, in _forward
        yolo_head_outs = self.yolo_head(neck_feats)
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 277, in forward
        if self.training:
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 288, in forward
        return self.forward_eval(feats)
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 242, in forward_eval
        for i, feat in enumerate(feats):
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 249, in forward_eval
        cls_logit = self.pred_cls[i](self.stem_cls[i](feat, avg_feat) +
    File "/home/ubuntu/git/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 50, in forward
        def forward(self, feat, avg_feat):
            weight = F.sigmoid(self.fc(avg_feat))
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            if self.conv:
                return self.conv(feat * weight)

    File "/home/ubuntu/miniconda3/envs/paddledet2/lib/python3.10/site-packages/paddle/base/dygraph/generated_tensor_methods_patch.py", line 46, in _sigmoid
        return _C_ops.sigmoid(*args, **kwargs)

    TypeError: (InvalidType) sigmoid(): argument (position 1) must be Value, but got Variable (at /paddle/paddle/fluid/pybind/eager_utils.cc:2263)

导出foundation model命令:

python tools/export_model.py -c configs/ppyoloe/ppyoloe_plus_crn_s_80e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_s_80e_coco.pdparams

复现环境 Environment

paddle-bfloat            0.1.7
paddle2onnx              2.0.2rc3
paddledet                0.0.0
paddlepaddle-gpu         3.3.0.dev20250904
  • paddledet从 git 安装
  • paddlepaddle-gpu 采用如下方式安装:

pip install -U --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu129/

  • GPU: NVIDIA GeForce RTX 5070
  • CUDA: 12.9

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions