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

Combining Inference and PEFT Tokens in a Batch #1153

Merged
merged 306 commits into from
Sep 4, 2024
Merged

Combining Inference and PEFT Tokens in a Batch #1153

merged 306 commits into from
Sep 4, 2024

Conversation

jiazhihao
Copy link
Collaborator

@jiazhihao jiazhihao commented Sep 27, 2023

Description of changes:

This PR combines LLM inference and PEFT tokens in a batch to enable kernel-level optimizations.

TODOs (first release):

  • Fix fusion issue
  • Optimizers (PR Peft optimizer #1290)
  • Align cross entropy loss
  • Implement code to initialize a new PEFT from scratch (instead of continuing the finetuning of existing ones)
  • Support upload back to Huggingface (PR HuggingFace Upload Feature #1300)
  • Python interface, similar to PEFT
  • Add option to add LoRA layers to every linear layer
  • Demo!

TODOs (remaining ones):

Related Issues:

Linked Issues:

  • Issue #

Issues closed by this PR:

  • Closes #

This change is Reviewable

@jiazhihao jiazhihao added the inference Features and fixes related to the inference project. label Sep 27, 2023
@jiazhihao jiazhihao marked this pull request as draft September 27, 2023 14:50
@wmdi wmdi requested review from wmdi and removed request for mengdiz97 September 27, 2023 19:29
@@ -255,7 +257,8 @@ void LLAMA::create_llama_model(FFModel &ff,
output = ff.sampling(softmax, generation_config.topp);
} else {
// output = ff.arg_top_k(dense, /*k=*/1, false);
output = ff.argmax(dense, /*beam_Search*/ false);
Tensor softmax = ff.softmax(dense, -1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jiazhihao why is this change required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because we used softmax cross entropy loss, so the last layer of the LLM must be softmax

@goliaro goliaro marked this pull request as ready for review September 4, 2024 17:27
@goliaro goliaro merged commit a0f1ed7 into inference Sep 4, 2024
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inference Features and fixes related to the inference project. peft Parameter-efficient finetuning as a service in FlexFlow
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants