-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
embedding: adjust n_ubatch
value, print error on insufficient n_batch
value
#6296
embedding: adjust n_ubatch
value, print error on insufficient n_batch
value
#6296
Conversation
@@ -114,7 +116,9 @@ int main(int argc, char ** argv) { | |||
for (const auto & prompt : prompts) { | |||
auto inp = ::llama_tokenize(ctx, prompt, true, false); | |||
if (inp.size() > n_batch) { | |||
inp.resize(n_batch); | |||
fprintf(stderr, "%s: error: number of tokens in input line (%lld) exceeds batch size (%lld), increase batch size and re-run\n", | |||
__func__, (long long int) inp.size(), (long long int) n_batch); |
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.
Here you can use %ld
instead of %lld
, no need to cast the type then
__func__, (long long int) inp.size(), (long long int) n_batch); | |
__func__, inp.size(), n_batch); |
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.
applied & rolled back due to build failure.
IIRC, this is why I used %lld
with casting in #6193. Although I tried your suggestion just in case 😉.
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.
We normally use PRIu64 / PRId64
to print 64-bit integers. Alternatively, in this case just %d
and cast to (int)
is fine
Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
…tch`-overflow' of github.com:mscheong01/llama.cpp into embedding-assign-`n_ubatch`-value,-print-error-on-`n_batch`-overflow
This reverts commit ea753ed.
* embedding: assign `n_ubatch` value, print error on `n_batch` overflow * Update examples/embedding/embedding.cpp Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com> * use %ld instead of %lld * Revert "use %ld instead of %lld" This reverts commit ea753ed. --------- Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
* embedding: assign `n_ubatch` value, print error on `n_batch` overflow * Update examples/embedding/embedding.cpp Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com> * use %ld instead of %lld * Revert "use %ld instead of %lld" This reverts commit ea753ed. --------- Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
* embedding: assign `n_ubatch` value, print error on `n_batch` overflow * Update examples/embedding/embedding.cpp Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com> * use %ld instead of %lld * Revert "use %ld instead of %lld" This reverts commit ea753ed. --------- Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
updates to the
embedding
example based on discussion from #6193n_batch
value tou_batch