-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Check for llama_get_logits_ith() errors #7448
base: master
Are you sure you want to change the base?
Changes from 8 commits
99291c0
ac6bed1
5224b65
bc9a2e8
cc363da
6b17898
aa3094c
a948952
8be06dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,9 @@ int main(int argc, char ** argv) { | |
// stochastic verification | ||
|
||
llama_token_data_array dist_tgt = llama_sampling_prepare(ctx_sampling, ctx_tgt, NULL, drafts[s_keep].i_batch_tgt[i_dft], true, NULL); | ||
if (dist_tgt.data == NULL) { | ||
return 1; | ||
} | ||
llama_sample_softmax(ctx_tgt, &dist_tgt); | ||
float p_tgt = 0, p_dft = 0; | ||
|
||
|
@@ -337,6 +340,9 @@ int main(int argc, char ** argv) { | |
// sample from the target model | ||
LOG("sampling target: s_keep = %3d, i_dft = %3d, i_batch_tgt = %3d\n", s_keep, i_dft, drafts[s_keep].i_batch_tgt[i_dft]); | ||
token_id = llama_sampling_sample(ctx_sampling, ctx_tgt, NULL, drafts[s_keep].i_batch_tgt[i_dft]); | ||
if (token_id == -1) { | ||
return 1; | ||
} | ||
|
||
llama_sampling_accept(ctx_sampling, ctx_tgt, token_id, true); | ||
|
||
|
@@ -457,7 +463,9 @@ int main(int argc, char ** argv) { | |
continue; | ||
} | ||
|
||
llama_sampling_sample(drafts[s].ctx_sampling, ctx_dft, NULL, drafts[s].i_batch_dft); | ||
if (llama_sampling_sample(drafts[s].ctx_sampling, ctx_dft, NULL, drafts[s].i_batch_dft) == -1) { | ||
return -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It returns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. But it's |
||
} | ||
|
||
const auto & cur_p = drafts[s].ctx_sampling->cur; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes it's a
return 1
, other times it's an assertion, or an exception.Which to use when? Should a single way be chosen?