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

Split learning LLM example. #366

Merged
merged 27 commits into from
Nov 10, 2023
Merged

Split learning LLM example. #366

merged 27 commits into from
Nov 10, 2023

Conversation

dixiyao
Copy link
Collaborator

@dixiyao dixiyao commented Nov 8, 2023

Description

  • Added three more API functions in the plato/trainer/split_learning: forward_to_intermediate_feature, update_weights_before_cut, test_model_split_leaffect. Revised the API for better design such as avoiding possible memory leakage.
  • The revision will not affect previous split learning examples.
  • Provide an example of fine-tuning Huggingface (GPT-2, OPT) with the split learning. First, the split_learning_llm_model.py includes the client model and the server model the contain layers on the client or on the server. The split_learning_trainer.py shows how we can use the current split learning API to train LLM with split learning. We directly use the huggingface trainer during the testing phase.
  • The LoRA fine-tuning is supported by using LoRA model in split_learning_llm_model.py and the LoRA algorithm for split learning split_learning_lora_algorithm.py.

How has this been tested?

To test the GPT2

python ./examples/split_learning/llm_split_learning/split_learning_main.py -c ./examples/split_learning/llm_split_learning/split_learning_wikitext2_gpt2.yml 

To test the OPT

python ./examples/split_learning/llm_split_learning/split_learning_main.py -c ./examples/split_learning/llm_split_learning/split_learning_wikitext2_opt350m.yml

To test the LoRA GPT2

python ./examples/split_learning/llm_split_learning/split_learning_main.py -c ./examples/split_learning/llm_split_learning/split_learning_wikitext2_gpt2_lora.yml 

Types of changes

  • Bug fix (non-breaking change which fixes an issue) Fixes #
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code has been formatted using Black and checked using PyLint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for platodocs canceled.

Name Link
🔨 Latest commit 5f48c7f
🔍 Latest deploy log https://app.netlify.com/sites/platodocs/deploys/654d96286c6e90000958a005

@dixiyao dixiyao marked this pull request as draft November 8, 2023 16:02
@dixiyao dixiyao marked this pull request as ready for review November 8, 2023 17:09
@baochunli baochunli merged commit 3f55ba7 into main Nov 10, 2023
6 checks passed
@dixiyao dixiyao deleted the SplitLearningLLM branch November 10, 2023 23:16
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.

4 participants