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

stack-llama #273

Merged
merged 16 commits into from
Apr 5, 2023
Merged

stack-llama #273

merged 16 commits into from
Apr 5, 2023

Conversation

edbeeching
Copy link
Collaborator

adds the stack-llama example

@edbeeching edbeeching requested review from lewtun and lvwerra April 4, 2023 11:13
@edbeeching edbeeching marked this pull request as draft April 4, 2023 11:15
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 4, 2023

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

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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.

Looks in really good! Left a few comments.

What do you think about simplifying the naming of the scripts a bit:

  • reward_modeling.py
  • rl_training.py
  • supervised_finetuning.py

Even if we used DeepSpeed, since with PEFT it should work as well without I think we can omit it here for simplification. What do you think?

1. Supervised fine-tuning of the base llama-7b model to create llama-7b-se:
- `python examples/stack_llama/scripts/sft_stack_exchange_peft.py --model_path=<LLAMA_MODEL_PATH> --streaming --no_gradient_checkpointing --learning_rate 1e-5 --max_steps 5000 --output_dir ./llama-se`
2. Reward modeling using dialog pairs from the SE dataset using the llama-7b-se to create llama-7b-se-rm:
- `deepspeed --num_gpus=8 examples/stack_llama/scripts/reward_modeling_peft.py --model_name=<LLAMA_SE_MODEL> --deepspeed="/fsx/kashif/llama-SE/ds_config.json"`
Copy link
Member

Choose a reason for hiding this comment

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

We don't really need DS for this right if we use PEFT? can we just use accelerate here? I think this would make things much simpler.

Copy link
Member

Choose a reason for hiding this comment

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

cc @kashif

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I agree, just matching what was used when @kashif trained

- `deepspeed --num_gpus=8 examples/stack_llama/scripts/reward_modeling_peft.py --model_name=<LLAMA_SE_MODEL> --deepspeed="/fsx/kashif/llama-SE/ds_config.json"`
3. RL fine-tuning of llama-7b-se with the llama-7b-se-rm reward model:
- `acclerate launch examples/stack_llama/scripts/rl_finetuning_peft.py --log_with=wandb --model_name=<LLAMA_SE_MODEL> --reward_model_name=<LLAMA_SE_RM_MODEL> --adafactor=False --tokenizer_name=<LLAMA_TOKENIZER> --save_freq=100 --output_max_length=128 --batch_size=8 --gradient_accumulation_steps=8 --batched_gen=True --ppo_epochs=4 --seed=0 --learning_rate=1.4e-5 --early_stopping=True --output_dir=llama-se-rl-finetune-128-8-8-1.4e-5_adam`

Copy link
Member

Choose a reason for hiding this comment

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

I think we should have a note that if you want to use multiple GPUs you should use torchrun plust the appropriate args (same with accelerate).

actually we could also add the mutli-gpu commands as default since they also work for 1 GPU.

@edbeeching edbeeching marked this pull request as ready for review April 5, 2023 12:56
@edbeeching edbeeching merged commit d8ae4d0 into main Apr 5, 2023
@edbeeching edbeeching deleted the stack-llama branch April 5, 2023 15:11
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.

3 participants