-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Refactor KTO coordinated with DPO [a/N]: Remove encoder-decoder support #4792
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
base: main
Are you sure you want to change the base?
Refactor KTO coordinated with DPO [a/N]: Remove encoder-decoder support #4792
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
Yes, as @albertvillanova says, I advocated for this change in #3906. It is important change, so I would be interested to hear the opinions of @lewtun, @edbeeching, and @kashif, and ensure we are aligned on this decision for both KTO and DPO. |
trl/experimental/kto/kto_trainer.py
Outdated
| pad_token_id=processing_class.pad_token_id, | ||
| label_pad_token_id=args.label_pad_token_id, | ||
| is_encoder_decoder=self.is_encoder_decoder, | ||
| is_encoder_decoder=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could probably remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here and in other places.
Yes I agree it is best to streamline the repo and cut features which (presumably) are not widely used. |
qgallouedec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few suggestions, otherwise lgtm!
| "label_pad_token_id": self.label_pad_token_id, | ||
| "max_prompt_length": self.max_prompt_length, | ||
| "max_completion_length": self.max_completion_length, | ||
| "max_completion_length": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "max_completion_length": None, |
| "truncation_mode": trainer.truncation_mode, | ||
| "label_pad_token_id": trainer.label_pad_token_id, | ||
| "max_prompt_length": trainer.max_prompt_length, | ||
| "max_completion_length": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "max_completion_length": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and remove all kwargs["max_completion_length"] in _process_tokens
EDIT: ignore the above, none remain
Refactor KTO coordinated with DPO [a/N]: Remove encoder-decoder support.
This cleanup significantly simplifies the KTO trainer and makes subsequent refactoring much easier.
Part of:
Coordinated with:
Key Changes:
is_encoder_decoderparameter and documentationmax_completion_lengthparameter (because it is specific to encoder-decoder models) and documentationKTOTrainer
Initialization:
Data Processing:
Model Forward Pass:
Reference Model Computation:
Error Handling: