-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SplitToSequence op with string tensor inputs behaves incorrectly in ONNX Runtime 1.17.1 #19726
Comments
@pranavsharma can you look into this? |
After a bit more testing it doesn't seem related to the keepdims argument, I think it's specific to strings. Looks like there's a special case for string inputs in the code, I'll try to put together a test for that op with strings. |
This test case which I added to TEST(SequenceOpsTest, SplitToSequence_PositiveAxisStringSplit) {
OpTester test("SplitToSequence", 11);
test.AddInput<std::string>("input", {2}, std::vector<std::string>({"Test string", "Another string"}));
int64_t axis = 0;
test.AddAttribute("axis", axis);
SeqTensors<std::string> output;
output.AddTensor({1}, {"Test string"});
output.AddTensor({1}, {"Another string"});
test.AddSeqOutput("S2", output);
test.Run();
} Error message:
An otherwise identical test which splits a single dimensional float tensor passes, so it's something in the string special case, but unfortunately my C++ knowledge isn't good enough to figure out exactly what it's doing. |
Describe the issue
The
SplitToSequence
operator behaves incorrectly in ORT 1.17.1 when keepdims=0 and running on string sequences (not sure if both are necessary, but we have other uses ofSplitToSequence
which don't fail which don't set keepdims and aren't on strings). Instead of splitting the tensor along the specified axis of size n and returning a sequence of length n it just returns the first element n times. This op works correctly in ORT 1.16.3.As far as I can tell this is the only PR which touches the relevant op between v1.16.3 and v1.17.1 - #18594.
cc @yuslepukhin
To reproduce
Running the following code in ORT 1.17 produces an incorrect output:
gives the output:
whereas on ORT 1.16.3 it gives:
Rename
split-to-sequence.onnx.txt
tosplit-to-sequence.onnx
.split-to-sequence.onnx.txt
The ONNX model was generated with this code:
Urgency
Yes, this blocks batch use of ONNX Runtime when embedding strings using BERT tokenizers in our system and batches are important for building the vector index quickly.
Platform
Linux
OS Version
Oracle Linux 9
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
v1.17.1
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: