RapidAI / RapidAI/RapidDoc

PP-DocLayoutV2模型批量推理报错

Open
#33 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
230
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Traceback (most recent call last):
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\inference_engine\onnxruntime\main.py", line 75, in __call__
    return self.session.run(self.get_output_names(), input_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\.venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 287, in run
    return self._sess.run(output_names, input_feed, run_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running ScatterND node. Name:'ScatterND.1' Status Message: updates tensor should have shape equal to indices.shape[:-1] + data.shape[indices.shape[-1]:]. updates shape: {1}, indices shape: {2}, data shape: {302,2}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\code\rapid_doc\rapid_doc_202601021446.py", line 10, in <module>
    all_results = model.__call__(img_contents=img_contents, batch_size=128)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\main.py", line 50, in __call__
    results = self.model_handler(batch_imgs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\model_handler\main.py", line 34, in __call__
    return self.model_processors(img_list)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\model_handler\pp_doclayout\main.py", line 54, in __call__
    batch_preds = self.session(img_inputs, scale_factor_inputs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\inference_engine\onnxruntime\main.py", line 78, in __call__
    raise ONNXRuntimeError(error_info) from e
rapid_doc.model.layout.rapid_layout_self.inference_engine.onnxruntime.main.ONNXRuntimeError: Traceback (most recent call last):
  File "D:\code\rapid_doc\model\layout\rapid_layout_self\inference_engine\onnxruntime\main.py", line 75, in __call__
    return self.session.run(self.get_output_names(), input_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\.venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 287, in run
    return self._sess.run(output_names, input_feed, run_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running ScatterND node. Name:'ScatterND.1' Status Message: updates tensor should have shape equal to indices.shape[:-1] + data.shape[indices.shape[-1]:]. updates shape: {1}, indices shape: {2}, data shape: {302,2}


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with model/layout/rapid_layout_self/model_handler/pp_doclayout/main.py, where batch inputs are passed to the ONNX Runtime session, then inspect inference_engine/onnxruntime/main.py and reproduce the failure with the reported batch_size=128. Done means PP-DocLayoutV2 batch inference completes without the reported ScatterND ONNXRuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.