Skip to content
Merged
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
3 changes: 2 additions & 1 deletion fastchat/train/train_with_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def mask_targets(conversations, targets, tokenizer, conv):
if i != 0:
turn = user_turn_separator + turn

turn_len = len(tokenizer(turn).input_ids)
turn_len = len(tokenizer(turn, add_special_tokens=False).input_ids)

if assistant_turn_separator in turn:
parts = turn.rsplit(assistant_turn_separator)
Expand Down Expand Up @@ -373,6 +373,7 @@ def train():
)
# NOTE: if the token_id exceed the vocab_size will cause failing in training process! we need add special config and resize the embedding size!
tokenizer.pad_token = tokenizer.unk_token
tokenizer.pad_token_id = tokenizer.unk_token_id
print(f"tokens len: {len(tokenizer)}")
model.resize_token_embeddings(len(tokenizer))

Expand Down