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

GroundingDINO模型onnx转bmodel时,报keyError: 'operand /Constant_2_output_0 not found' #204

Open
jiajia1417 opened this issue Dec 27, 2024 · 0 comments

Comments

@jiajia1417
Copy link

报下面这个错误

Traceback (most recent call last):
  File "/workspace/tpu-mlir/python/tools/model_transform.py", line 442, in <module>
    tool.model_transform(args.mlir, args.add_postprocess, args.patterns_count)
  File "/workspace/tpu-mlir/python/tools/model_transform.py", line 63, in model_transform
    self.converter.generate_mlir(mlir_origin)
  File "/workspace/tpu-mlir/python/transform/OnnxConverter.py", line 739, in generate_mlir
    self.onnxop_factory.get(n.op_type, lambda x: NoneAndRaise(x))(n)
  File "/workspace/tpu-mlir/python/transform/OnnxConverter.py", line 250, in <lambda>
    "ReduceMax": lambda node: self.convert_reduce_op(node),
  File "/workspace/tpu-mlir/python/transform/OnnxConverter.py", line 1909, in convert_reduce_op
    op = self.getOperand(onnx_node.inputs[0])
  File "/workspace/tpu-mlir/python/transform/BaseConverter.py", line 54, in getOperand
    raise KeyError("operand {} not found".format(name))
KeyError: 'operand /Constant_2_output_0 not found'

但是我检查onnx节点时,发现是有/Constant_2_output_0这个输出节点的
用下面代码打印onnx节点

for idx, node in enumerate(model.graph.node):
    print(f"\n节点 {idx + 1}:")
    print(f"  名称: {node.name}")
    print(f"  类型: {node.op_type}")
    print(f"  输入: {node.input}")
    print(f"  输出: {node.output}")

输出结果

节点 15810:
  名称: /class_embed.0/Constant_2
  类型: Constant
  输入: []
  输出: ['/class_embed.0/Constant_2_output_0'] 

可以看到是有Constant_2_output_0这个键的,但是还是报了 KeyError: 'operand /Constant_2_output_0 not found 这个错误

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

No branches or pull requests

1 participant