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

qwen2 onnx model attention_mask && output_past_kv shape is wrong #1990

Open
2 of 4 tasks
AACengineer opened this issue Aug 16, 2024 · 0 comments
Open
2 of 4 tasks

qwen2 onnx model attention_mask && output_past_kv shape is wrong #1990

AACengineer opened this issue Aug 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AACengineer
Copy link

AACengineer commented Aug 16, 2024

Who can help?

using optimum exporter to export qwen2-0.5b to onnx model, I find onnx model attention_mask with shape [batch_size, past_sequence_length + 1]. And in validation, onnx inputs/outputs with shape:
onnx_inputs["input_ids"].shape = (2, 16)
onnx_inputs["attention_mask"].shape = (2, 32)
onnx_inputs["position_ids"].shape = (2, 16)
onnx_inputs["past_key_values.0.key"].shape = (2, 2, 16, 64)

onnx_output["logits"].shape=(2, 16, 151936)
onnx_output["present.0.key"].shape=(2, 2, 32, 64)

attention_mask shape should be [batch_size, sequence_length + past_sequence_length]? output_past_kv shape be [batch_size, kv_heads, sequence_length + past_sequence_length, head_dims] ? @michaelbenayoun
3

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction (minimal, reproducible, runnable)

optimum-cli export onnx --model qwen/qwen2-0___5b-instruct/ ./onnx --task text-generation-with-past

Expected behavior

Confirm whether there are any errors in shape

@AACengineer AACengineer added the bug Something isn't working label Aug 16, 2024
@AACengineer AACengineer changed the title qwen2 onnx model attention_mask shape is wrong qwen2 onnx model attention_mask && output_past_kv shape is wrong Aug 19, 2024
@michaelbenayoun michaelbenayoun self-assigned this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants