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

SFTConfig type wrong #178

Closed
the-utkarshjain opened this issue Jul 9, 2024 · 4 comments
Closed

SFTConfig type wrong #178

the-utkarshjain opened this issue Jul 9, 2024 · 4 comments

Comments

@the-utkarshjain
Copy link

This issue is in context with run_sft.py. Might occur with other tasks too.

The SFTTrainer class expects SFTConfig to be an instance of trl.SFTConfig. However, transformers.TrainingArguments is being passed. Due to this, the code usually throws an error when private variable of trl.SFTConfig like dataset_num_proc, etc are not passed. The bigger issue is that the code works with transformers.TrainingArguments, so you can't even pass those variables through the YAML file, or else the code throws an error saying there are extra arguments which aren't used by the program.

@the-utkarshjain
Copy link
Author

The solution is simple. Go to src/configs and add these lines:

  1. import trl (at the top of the file)
  2. Change class SFTConfig(transformers.TrainingArguments) to class SFTConfig(trl.SFTConfig)

Don't forget to install the handbook with python -m pip install -e . (note the -e option or else your changes won't be read).

@tanliboy
Copy link

Thank you, @the-utkarshjain ! It took me a while to figure out TRL has switched and doesn't support the subclass of TrainingArguments as its parameter right now.

@tanliboy
Copy link

We also need to fix the DPOConfig that has the same problem.

@snoels
Copy link

snoels commented Jul 17, 2024

A quick fix is: pip install trl==0.8.2

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 a pull request may close this issue.

4 participants