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

Fix previous text prepending #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions training/run_distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,13 +1189,13 @@ def prepare_train_dataset(batch):
# check that the length of the prompt does not exceed more than half the max label length (224)
if len(prev_ids) > prompt_cutoff_length:
prev_ids = prev_ids[-prompt_cutoff_length + 1 :]
prev_ids = [decoder_prev_token_id] + prev_ids

# and that the total length of the labels does not exceed the max label length (448)
if len(prev_ids + token_ids) > max_label_length:
trim_length = len(prev_ids + token_ids) - max_label_length + 1
if len(prev_ids + token_ids) + 1 > max_label_length:
trim_length = len(token_ids) - max_label_length + 1
prev_ids = prev_ids[trim_length:]
prev_ids = [decoder_prev_token_id] + prev_ids

prev_ids = [decoder_prev_token_id] + prev_ids

token_ids = prev_ids + token_ids

Expand Down