CarperAI / CarperAI/trlx

Flant-t5-large Deepspeed OVERFLOW! issues + bad outputs after trlx training

Open
#383 8 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
4.8k
Forks
487
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Describe the bug

Hi, I'm trying to use `ilql` training on custom data with `flan-t5-large` and `flan-t5-xl` models to fine-tune them using RLHF and `gpt-j-6B` as a reward model.

1. I have completed the 1st `sft` step for the both `flan-t5` models with a custom training script and a custom dataset.
-> The model is working. I can load it and use it for inference.

2. I have completed the 2nd step, getting `gpt-j` reward_model checkpoints. The model was also fine-tuned in a first `sft` step like the `flan-t5` ones. So, now I get the pytorch_model.bin of this new reward model ready to be used.
I also used custom data with `prompt`, `chosen`, and `rejected` things like mentioned in the [blog post](https://wandb.ai/carperai/summarize_RLHF/reports/Implementing-RLHF-Learning-to-Summarize-with-trlX--VmlldzozMzAwODM2#comparison-dataset).

3. I'm here 👋

I'm using this script from your examples: https://github.com/CarperAI/trlx/blob/main/examples/summarize_rlhf/ilql_summarize_t5.py

So I'm trying to improve the `flan-t5` models' performances using RLHF, but I face problems when it comes to this step:
![CleanShot 2023-03-20 at 17 17 23](https://user-images.githubusercontent.com/50595514/226402878-49202ace-810e-4100-9b00-cb712d23f51d.png)

Deepspeed keeps telling me there is an `OVERFLOW!` issue, and it needs to scale down the loss. And after 8-9 loss scale attempts, the training crashes.

So I trained using suggested models/datasets from the example script to see how it goes on your side by default. And there are also `OVERFLOW!` issues, but after 4 loss scale attempts, it runs well.

![CleanShot 2023-03-20 at 17 20 48](https://user-images.githubusercontent.com/50595514/226403825-18cc5027-89e8-4aaf-841b-0cb7f3a8fbbd.png)

- Is my reward model broken?
- Is my dataset too tiny to get something from RLHF?
- Is my parameters bad? (Using the one used in the demo script)
- Could it come from the fact my initial `flan-t5` models were trained with `bf16` or `fp32`?

Any hint would be so much appreciated 🤗

### Which trlX version are you using?

`trlx` main branch

### Additional system and package information

GCP Pytorch 1.13.1, CUDA 11.6, 2xA100 40GBs, transformers>=4.26.1, deepspeed>=0.8.2, accelerate>=0.16.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.