You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is OGA support the feature all DeviceSpan<int32_t>& next_tokens are model.pad_token_id?
If the answer is Yes, there maybe bug in the following code. if the answer is No, do you have plan to support this feature? or how do you deal with this scene?
If all DeviceSpan<int32_t>& next_tokens are model.pad_token_id:
in the following code, after the end of while loop, token_index will be -1, and input_sequence_lengths[b] will be 0;
then go to the following code, token_index = -1; then in L55, the first parameter of logits_raw.subspan(), (vocab_index * seq_length + token_index * vocab_size) * element_size maybe = (0 * seq_length + (-1 ) * vocab_size) * element_size = -1 * vocab_size * element_size, it's a negative value.
in the subspan(), the parameter datatype is size_t, it's unsigned, so if the first parameter is a negative value, it maybe very large as to size_t, then L417 will report error and lead to crash.
using size_type = size_t;
The text was updated successfully, but these errors were encountered:
buyuliushen
changed the title
Feature or Bug: Is OGA support the feature all '''DeviceSpan<int32_t>& next_tokens''' are '''model.pad_token_id'''?
Feature or Bug: Is OGA support the feature all DeviceSpan<int32_t>& next_tokens are model.pad_token_id?
Mar 4, 2025
@aciddelgado You probably know the most about this new continuous decoding logic, we should support this edge case. I can add a unit test but what do you think the best behavior is when it happens?
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Is OGA support the feature all
DeviceSpan<int32_t>& next_tokens
aremodel.pad_token_id
?If the answer is Yes, there maybe bug in the following code. if the answer is No, do you have plan to support this feature? or how do you deal with this scene?
If all
DeviceSpan<int32_t>& next_tokens
aremodel.pad_token_id
:in the following code, after the end of while loop,
token_index
will be-1
, andinput_sequence_lengths[b]
will be0
;onnxruntime-genai/src/models/logits.cpp
Lines 96 to 103 in b247a93
then go to the following code,
token_index = -1
; then in L55, the first parameter oflogits_raw.subspan()
,(vocab_index * seq_length + token_index * vocab_size) * element_size
maybe =(0 * seq_length + (-1 ) * vocab_size) * element_size
=-1 * vocab_size * element_size
, it's a negative value.onnxruntime-genai/src/models/logits.cpp
Lines 52 to 58 in b247a93
in the
subspan()
, the parameter datatype issize_t
, it's unsigned, so if the first parameter is a negative value, it maybe very large as tosize_t
, then L417 will report error and lead to crash.using size_type = size_t;
The text was updated successfully, but these errors were encountered: