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

adds sentiment example for a 20b model #208

Merged
merged 10 commits into from
Mar 9, 2023
Merged

Conversation

edbeeching
Copy link
Collaborator

This PR adds a sentiment example for a 20b model.
There are 3 scripts:

  1. s01_cm_finetune_peft_imdb.py - Fine tuning a Low Rank Adapter on a frozen 8-bit model for text generation on the imdb dataset.
  2. s02_merge_peft_adapter.py - Merging of the adapter layers into the base model’s weights and storing these on the hub.
  3. s03_gpt-neo-20b_sentiment_peft.py - Sentiment fine-tuning of a Low Rank Adapter to create positive reviews.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 9, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this! Left few nits!
Let's also add a line about it on the docs 💪 Let me know if you want me to do that!

Copy link
Member

@lvwerra lvwerra left a comment

Choose a reason for hiding this comment

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

In general happy to merge. Two comments

  • left a nit about the naming
  • we should add it to the list of examples in the docs

examples/sentiment/scripts/gpt-neox-20b_peft/README.md Outdated Show resolved Hide resolved
edbeeching and others added 9 commits March 9, 2023 14:59
…entiment_peft.py

Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
…entiment_peft.py

Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
…entiment_peft.py

Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
…entiment_peft.py

Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this!

@younesbelkada younesbelkada merged commit ddb6df3 into main Mar 9, 2023
@younesbelkada younesbelkada deleted the peft-gpt-neox-20b branch March 9, 2023 14:29
@Kororinpas
Copy link

Hi,there. I am a beginner in the field of NLP and I have been working with the GPT-J model recently. I came across your code for merging adapter layers into the base model's weights in s02_merge_peft_adapter.py , and I have some questions regarding the merging process.

From my understanding, after fine-tuning the model with the LORA layer and running this merging code, the LORA layer is replaced with a new randomly initialized linear layer. However, I did not see any indication in the code that the parameters of the LORA layer were inherited by this new linear layer.If this is the case, then it would mean that my previous training of only the LORA layer was pointless.

I would be grateful if you could provide me with some clarification on this matter. Thank you very much for your time and help.

@younesbelkada
Copy link
Contributor

younesbelkada commented Apr 8, 2023

Hi @Kororinpas
Please have a look at this nice thread: #250 that goes over the details of merging LoRA layers!
Also now you can directly merge the lora layers using peft with the model.merge_and_unload() utility function, see huggingface/peft#227
Let us know if you have more questions after that

@Kororinpas
Copy link

@younesbelkada Thank you for sharing this information with me. I have already checked out the thread you suggested and the original code. Now, my problem is solved. Thanks again!

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.

5 participants