Skip to content

Help needed: RKNN conversion fails on Vosk model — "Expand input shape not correct" #362

@dulimov

Description

@dulimov

Hi all,

We’re currently working on porting the Vosk ASR model to RK3588 using rknn-toolkit2.
We’ve made a public repo to track our work and issues:
🔗 https://github.com/dulimov/vosk-rknn

Our conversion script:
📜 conv.py

Conversion log with errors:
📄 conv_output.log

During conversion we get the following error:

W The shape is not correct: [3,2] vs [3,1]
E Convert node[Expand_28] failed, type[Expand]!
E Catch exception when convert op[Expand_28]!
RuntimeError: Expand input shape not correct.
We've tried simplifying and modifying the ONNX model (e.g., editing shapes, simplifying nodes, removing some ops), but the error persists.

❓ Question: How can we correctly convert this model? Any guidance on how to handle this Expand shape mismatch would be very helpful.

Thanks a lot in advance!

Processing top-level node: /encoder_proj/MatMul, OpType: MatMul
Processing top-level node: /encoder_proj/Add, OpType: Add
ensure_correct_conv_attributes: Changes made to some Conv attributes (either specific or general).
--- Sanity check for saved file: vosk_models_onnx/encoder_prepared.onnx ---
ERROR: ONNX Runtime failed to load vosk_models_onnx/encoder_prepared.onnx: [ONNXRuntimeError] : 1 : FAIL : Load model from vosk_models_onnx/encoder_prepared.onnx failed:Node (/encoder_embed/conv/0/Conv) Op (Conv) [ShapeInferenceError] Attribute dilations has incorrect size

--- Processing model: decoder ---
--- Sanity check for saved file: vosk_models_onnx/decoder_prepared.onnx ---
ONNX Runtime loaded vosk_models_onnx/decoder_prepared.onnx successfully.

--- Processing model: joiner ---
--- Sanity check for saved file: vosk_models_onnx/joiner_prepared.onnx ---
ONNX Runtime loaded vosk_models_onnx/joiner_prepared.onnx successfully.

--- Creating Dummy Calibration Data ---

--- Converting to RKNN ---

Processing encoder model: vosk_models_onnx/encoder_prepared.onnx

I Loading : 0%| | 0/717 [00:00<?, ?it/s]
I Loading : 100%|██████████████████████████████████████████████| 717/717 [00:00<00:00, 13636.09it/s]

I FoldConstant : 0%| | 0/5324 [00:00<?, ?it/s]
I FoldConstant : 0%| | 1/5324 [00:00<00:16, 331.15it/s]

Metadata

Metadata

Assignees

No one assigned

    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