Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
use unk token instead of eos (#1198)
Browse files Browse the repository at this point in the history
Signed-off-by: Dillon Laird <dillonalaird@gmail.com>
  • Loading branch information
dillonalaird authored Jan 29, 2024
1 parent 172d399 commit 6387a0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,10 @@ def preprocess_v1(
# Mask targets
sep = conv.sep + conv.roles[1] + ": "
for conversation, target in zip(conversations, targets):
# total_len = int(target.ne(tokenizer.pad_token_id).sum())
total_len = int(target.ne(tokenizer.pad_token_id).sum())

rounds = conversation.split(conv.sep2)

total_len = int(target.ne(tokenizer.pad_token_id).sum()) + \
len([rou for rou in rounds if rou != ""])

cur_len = 1
target[:cur_len] = IGNORE_INDEX
for i, rou in enumerate(rounds):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def make_inputs_require_grad(module, input, output):
use_fast=use_fast
)

tokenizer.pad_token = tokenizer.eos_token
tokenizer.pad_token = tokenizer.unk_token

# set vision module
model.get_model().initialize_vision_modules(
Expand Down

0 comments on commit 6387a0a

Please sign in to comment.