Skip to content
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

llama: refactor llama_decode_impl #11381

Conversation

JohannesGaessler
Copy link
Collaborator

This PR refactors llama_decode_impl by moving some of the code to functions llama_prepare_sbatch and llama_prepare_ubatch. There should be no change to functionality. The motivation for the change is that this enables re-using the code for training in #10544 .

Copy link
Owner

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the #11213 refactoring, the llama_prepare_sbatch and llama_prepare_ubatch will be replaced with something like:

// internal llama_context logic will be implemented
// for example, the llama_prepare_sbatch logic will go here
llama_batch_manager_i bm = lctx.prepare_batch(batch, logits_all);

while (!bm->done()) {
    // the llama_prepare_ubatch() will be implemented here
    llama_ubatch ubatch = bm->next();

    ...
}

Feel free to merge. After merging, I will rebase the #11213 PR to illustrate this.

@JohannesGaessler JohannesGaessler merged commit df984e0 into ggerganov:master Jan 27, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants