peft icon indicating copy to clipboard operation
peft copied to clipboard

Use `peft` for RLHF

Open younesbelkada opened this issue 2 years ago • 4 comments

Feature request

We should leverage trl: https://github.com/lvwerra/trl - the recent library from Hugging Face for RLHF, to apply PPO using peft and LoRA

I think peft should just work out of the box, the first step could be trying to adapt gpt2-sentiment.py script: https://github.com/lvwerra/trl/blob/main/examples/sentiment/scripts/gpt2-sentiment.py to use peft

younesbelkada avatar Feb 11 '23 08:02 younesbelkada

@pacman100 @younesbelkada I could work on this if there is any interest. What would be the first steps?

BirgerMoell avatar Feb 15 '23 09:02 BirgerMoell

Thanks for your interest @BirgerMoell !! That would be definitely helpful We need to check first the compatbility of peft and trl (i.e. it might not directly work out of the box but we will need to double check), so we will most likely adapt the gpt2 script ourselves just to make sure we fix things that needs to be fixed, then you can help us maybe converting the t5 script? Let me know what do you think! If you feel you want to take the challenge and start converting the gpt2 script feel free to do it and we'll be happy to review your Pull Request / code changes ! 🔥

younesbelkada avatar Feb 15 '23 09:02 younesbelkada

I think it sounds like a good idea if you start out with the gpt2 script and then I can do the t5 script. I think that would be a nice way to do it and I can understand much more by following along with your work. Btw I'm on the huggingface discord if you want to messag me my username is birger

BirgerMoell avatar Feb 15 '23 09:02 BirgerMoell

The PR https://github.com/lvwerra/trl/pull/163 should add peft support on trl, we may need to convert the other scripts such as t5 summarization etc as well once this PR gets merged!

younesbelkada avatar Mar 02 '23 13:03 younesbelkada

Hi everyone, Closing this issue as we now officially support PEFT in TRL , making it possible to apply RLHF + PEFT

younesbelkada avatar Jun 21 '23 15:06 younesbelkada