LMFlow icon indicating copy to clipboard operation
LMFlow copied to clipboard

Can you please proive a more simple way to run a raft demo?

Open Randomstar-New opened this issue 3 years ago • 6 comments

When I tried to run a raft demo, I met several tough bugs and find it hard to fix. The project code is highly coupled which makes it difficult to run a single part of the algorithms implemented in the LMFlow. Could you please provide a more simple way to run a raft demo? I found LMFlow has become a pypi library but I could not find a raft alignment demo in the document https://optimalscale.github.io/LMFlow/autoapi/lmflow/pipeline/raft_aligner/index.html

Randomstar-New avatar Jul 05 '23 14:07 Randomstar-New

You may check https://optimalscale.github.io/LMFlow/examples/raft.html for a detailed tutorial. It seems that there is some index error so this blog is invisible from the index.html.

WeiXiongUST avatar Jul 07 '23 09:07 WeiXiongUST

Hi @WeiXiongUST , I have finished the second step of finetuning the llama7b reward model; how many 40g a100 GPUs are required to train the third step of raft?

Nipi64310 avatar Jul 13 '23 10:07 Nipi64310

Hi @WeiXiongUST , I have finished the second step of finetuning the llama7b reward model; how many 40g a100 GPUs are required to train the third step of raft?

You may try to run the raft with both a 7b llama and a 7b reward model but I am not sure whether it works.

Indeed, we are considering separate implementations for each stage (inference, reward computation, and fine-tuning), which should allow us to train 13B models with 13B reward models, with say 2 or 4 40G A100 GPUs. Meanwhile, we hope the new codes to be more accessible for users to modify for their customized needs.

We are still testing these codes to make sure that they are bug-free but plan to do so soon.

WeiXiongUST avatar Jul 14 '23 14:07 WeiXiongUST

Thanks for your response; I used the same base model(llama 7b), but a different lora, for reward prediction and model generation, and finished raft training.

Nipi64310 avatar Jul 17 '23 02:07 Nipi64310

@Nipi64310 @Zhang-Each

Hi! I just uploaded a temporary code that implements inference, reward computation, and supervised fine-tuning separately at https://github.com/WeiXiongUST/LMFlow-Raft-Test/blob/main/raft_iter.sh

You may have a look and try it out if interested. You just need to modify the script LMFlow-Raft-Test/raft_iter.sh with your own base_dir, starting model, and also your reward model and then run the script. I just tested it with reward model weqweasdas/hh_rlhf_rm_open_llama_3b and EleutherAI/gpt-neo-2.7B as the starting point and get

Model Reward Reward in the training set
2.849879826968017 4.7972367252572266
4.18692914528348 6.005162512218964
4.609836313614981 6.33424511002445
4.756306608168377 6.5123869745845555
4.9620205011302545 6.687813110948191
5.053306900277981 6.686728677908113
5.0530508270711145 6.753848973607038

All the hyper-parameters are left in this current version of code. If you encounter any problems, feel free to contact me!

WeiXiongUST avatar Jul 18 '23 09:07 WeiXiongUST

https://github.com/WeiXiongUST/LMFlow-Raft-Test/blob/main/raft_iter.sh

Thank you! I will try this version.

Randomstar-New avatar Jul 19 '23 02:07 Randomstar-New