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
//prompt: "Hello my name is"
llama_batch batch = llama_batch_init(ctx_params.n_ctx, 0, 1);
llama_decode(ctx, llama_batch_get_one(prompt_tokens.data(), prompt_tokens.size() - 1, 0, 0));
common_batch_add(batch, prompt_tokens.back(), prompt_tokens.size() - 1, {0}, true);
llama_decode(ctx, batch);
new_token_id = llama_sampler_sample(smpl, ctx, 0);
// output: new_token_id is 435, logit is 10.115658
When the batch have more than one token:
//prompt: "Hello my name is"
llama_batch batch = llama_batch_init(ctx_params.n_ctx, 0, 1);
llama_decode(ctx, llama_batch_get_one(prompt_tokens.data(), prompt_tokens.size() - 1, 0, 0));
//just an example batch
common_batch_add(batch, prompt_tokens.back(), prompt_tokens.size() - 1, {0}, true);
common_batch_add(batch, prompt_tokens.back(), prompt_tokens.size() , {0}, true);
common_batch_add(batch, prompt_tokens.back(), prompt_tokens.size() + 1, {0}, true);
llama_decode(ctx, batch);
new_token_id = llama_sampler_sample(smpl, ctx, 0);
// output: new_token_id is 435, logit is 10.103312
This question was found when I want to implement the speculative decoding by myself. The target model should verify all tokens in batch in parallel.But It got different logit about the first token in the batch compared with verifying token by token. I don`t no where the problem is. Can anyone help me? Thanks a lot!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When the batch have only one token:
When the batch have more than one token:
This question was found when I want to implement the speculative decoding by myself. The target model should verify all tokens in batch in parallel.But It got different logit about the first token in the batch compared with verifying token by token. I don`t no where the problem is. Can anyone help me? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions