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

Add SFT params random_offset_probability, label_masking #2005

Merged
merged 2 commits into from Mar 7, 2023

Conversation

andreaskoepf
Copy link
Collaborator

@andreaskoepf andreaskoepf commented Mar 7, 2023

Added SFT training parameters:

  • random_offset_probability (float, default: 0.5): probability of random offset into conversations when conversation > max_length
  • label_masking (bool, default: true): if true only loss for tokens of assistant replies is calculated else for all tokens (including prompter)

@@ -54,13 +64,20 @@ def __call__(self, features):
list(map(lambda x: x[1], flatten_message["offset_mapping"])),
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should not be required now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you make a suggested change (ctrl+g)?


# append eos token to each messages
assert self.tokenizer.eos_token
messages = [m + self.tokenizer.eos_token for m in messages]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did we converge to this? Using the end of prompt-reply the same as eos? Not totally against it if eveyone agrees

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

EOS at end of messages simplifies the decoding, TRLX also relies on eos tokens (i.e. would either have to be patched or eos could be set to <human>). The format is a compromise between framing format v3 and old <bot> <user> format v2.

@sanagno sanagno merged commit 9d64bb8 into main Mar 7, 2023
1 check passed
@sanagno sanagno deleted the sft_random_message_offsets branch March 7, 2023 15:29
alando46 pushed a commit to alando46/Open-Assistant that referenced this pull request Mar 10, 2023
Added SFT training parameters:
- `random_offset_probability` (float, default: 0.5): probability of
random offset into conversations when conversation > max_length
- `label_masking` (bool, default: true): if true only loss for tokens of
assistant replies is calculated else for all tokens (including prompter)
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.

None yet

2 participants