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

[BUG]onnx convert failed("KeyError: 'max_sequence_len'") #467

Open
ahqzy opened this issue Dec 29, 2024 · 1 comment
Open

[BUG]onnx convert failed("KeyError: 'max_sequence_len'") #467

ahqzy opened this issue Dec 29, 2024 · 1 comment

Comments

@ahqzy
Copy link

ahqzy commented Dec 29, 2024

hugectr2onnx_bst_test.zip
when do onnx inference(HugeCTR/test/onnx_converter_test/hugectr2onnx_bst_test.py), it failed as below:

# python ./hugectr2onnx_bst_test.py
[HUGECTR2ONNX][INFO]: Converting Data layer to ONNX
[HUGECTR2ONNX][INFO]: Converting DistributedSlotSparseEmbeddingHash layer to ONNX
[HUGECTR2ONNX][INFO]: Converting DistributedSlotSparseEmbeddingHash layer to ONNX
[HUGECTR2ONNX][INFO]: Converting DistributedSlotSparseEmbeddingHash layer to ONNX
[HUGECTR2ONNX][INFO]: Converting DistributedSlotSparseEmbeddingHash layer to ONNX
[HUGECTR2ONNX][INFO]: Converting DistributedSlotSparseEmbeddingHash layer to ONNX
[HUGECTR2ONNX][INFO]: Converting Slice layer to ONNX
Traceback (most recent call last):
  File "/nvidia_merlin/HugeCTR/test/onnx_converter_test/./bst.py", line 91, in <module>
    hugectr2onnx_bst_test(
  File "/nvidia_merlin/HugeCTR/test/onnx_converter_test/./bst.py", line 63, in hugectr2onnx_bst_test
    hugectr2onnx.converter.convert(onnx_model_path, graph_config, dense_model, True, sparse_models)
  File "/usr/local/lib/python3.10/dist-packages/hugectr2onnx-0.0.0-py3.10.egg/hugectr2onnx/converter.py", line 44, in convert
  File "/usr/local/lib/python3.10/dist-packages/hugectr2onnx-0.0.0-py3.10.egg/hugectr2onnx/hugectr_loader.py", line 320, in load_layer
KeyError: 'max_sequence_len'

How to solve this?

(attach is python code)

@KingsleyLiu-NV
Copy link
Collaborator

Hi @ahqzy , thanks for reporting this. There is an API mismatch in hugectr2onnx converter for SequenceMask and MultiHeadAttention layers in the latest versions, and we will try to fix it.

You can use nvcr.io/nvidia/merlin-hugectr:23.06 to do onnx conversion correctly for BST model:

docker run --runtime=nvidia --rm -it --net=host --cap-add SYS_NICE  -u root -v $(pwd):/hugectr -w /hugectr nvcr.io/nvidia/merlin/merlin-hugectr:23.06

python3 test/onnx_converter_test/train_scripts/bst_avg_pooling.py

python3 test/onnx_converter_test/hugectr2onnx_bst_test.py

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

2 participants