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

🎉 Add Multitask Prompt Tuning #400

Merged
merged 49 commits into from
Aug 25, 2023
Merged

Conversation

mayank31398
Copy link
Contributor

Adds code for the paper: https://arxiv.org/abs/2303.02861

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@mayank31398 mayank31398 marked this pull request as ready for review May 6, 2023 23:42
@mayank31398
Copy link
Contributor Author

@pacman100
Can you take a look at this PR?
This adds the functionality to use Multitask Prompt Tuning as proposed in this paper.

@mayank31398
Copy link
Contributor Author

Also, a working notebook has been added @pacman100 🤗

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you so much @mayank31398 for adding MultiTask Prompt Tuning 🔥! Could you please resolve the conflicts and run make style and make quality to resolve the quality issues. Post that we can go ahead and merge this PR 🤗.

@mayank31398
Copy link
Contributor Author

Done @younesbelkada :)

Copy link
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks so much for this PR and all the work you put in.

I haven't read the paper in detail, so I cannot comment on whether the implementation is faithful or not.

I have a few minor comments, please check my comments. Not all of that is critical. My main concern is that, if I'm not mistaken, only one prompt_tuning_init argument is tested. Therefore, I would like to see the tests extended to cover the other types.

As a nice-to-have feature, it would great if there were a few explanations in the notebook about what's going on + a link to the paper.

src/peft/peft_model.py Outdated Show resolved Hide resolved
src/peft/peft_model.py Outdated Show resolved Hide resolved
src/peft/peft_model.py Outdated Show resolved Hide resolved
src/peft/tuners/multitask_prompt_tuning.py Outdated Show resolved Hide resolved
src/peft/tuners/multitask_prompt_tuning.py Show resolved Hide resolved
src/peft/tuners/multitask_prompt_tuning.py Show resolved Hide resolved
src/peft/tuners/multitask_prompt_tuning.py Outdated Show resolved Hide resolved
src/peft/tuners/multitask_prompt_tuning.py Show resolved Hide resolved
@BenjaminBossan
Copy link
Member

I just noticed that there isn't any addition to the docs for MPT. Could you please add some documentation there? Or are we fine with adding it in a separate PR?

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Hello @mayank31398, Thank you for iterating! I believe the PR can be merged once the conflicts are resolved as there is an example showing usage and related tests. Thank you for all the work and for your kind patience 🤗

@mayank31398
Copy link
Contributor Author

Hey @pacman100 let me add some comments in the code.
There is a some stuff that isn't clear.
I will also resolve the merge conflicts over the weekend

@mayank31398
Copy link
Contributor Author

@pacman100 I have addressed the suggestions.
Can you run the unittests?
Thanks

@mayank31398
Copy link
Contributor Author

@pacman100 @younesbelkada lets merge this?

@mayank31398
Copy link
Contributor Author

Hey, guys still waiting for an update :)

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 your patience @mayank31398 and sorry for the delay , I left two tiny comments, apart from that I trust other maintainers review. Can you please revert the changes in the unrelated files?
Thanks!

@mayank31398
Copy link
Contributor Author

@younesbelkada addressed the comments

@BenjaminBossan
Copy link
Member

@mayank31398 Just to let you know: We'll probably soon merge #807 which adds a new folder structure to the tuners. If you want to, you can already adjust your code to use the new structure. Otherwise, it's also fine as is, then we'll do the refactoring later.

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 again!

@mayank31398
Copy link
Contributor Author

@mayank31398 Just to let you know: We'll probably soon merge #807 which adds a new folder structure to the tuners. If you want to, you can already adjust your code to use the new structure. Otherwise, it's also fine as is, then we'll do the refactoring later.

I prefer leaving as is for now.
I am a little busy with some other stuff :)
Lets refactor later

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @mayank31398 for iterating multiple times and for your patience, LGTM! 🔥🚀✨

@pacman100 pacman100 merged commit 0e37b85 into huggingface:main Aug 25, 2023
11 checks passed
@mayank31398 mayank31398 deleted the mpt-os-test branch August 25, 2023 13:59
@junzhang-zj
Copy link

@mayank31398 Why can't I locate the distillation process of the source prompt in the code? Am I missing something? 😭

@mayank31398
Copy link
Contributor Author

@junzhang-zj yeah, it doesn't have that.
Its not simple to add it to this repo I think.
This is a basic MPT pipeline where you pretrain a joing prompt on a bunch of task, use it for initialization of target prompt and then finetune it for the target prompt.

@junzhang-zj
Copy link

@mayank31398 Thank you for your answer, which addressed my concern about carelessness!

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.

None yet

7 participants