mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-30 02:53:41 +08:00
Don't dupe BOS
Ensure completion batching doesn't allow BOS dupes for instruction models with chat models whose tokenizer configurations have ```add_bos_token = True``` (see: 1095)
This commit is contained in:
parent
69282ab7fc
commit
3f08dfc762
@ -166,7 +166,7 @@ def iterate_completion_batches(
|
||||
for j in batch_idx[i]:
|
||||
prompt, completion = dataset.get_prompt_and_completion(j)
|
||||
prompt_lengths.append(input_length(prompt, completion, tokenizer))
|
||||
full_sequence = tokenizer.encode(dataset[j])
|
||||
full_sequence = tokenizer.encode(dataset[j], add_special_tokens=False)
|
||||
if full_sequence[-1] != tokenizer.eos_token_id:
|
||||
full_sequence.append(tokenizer.eos_token_id)
|
||||
batch.append(full_sequence)
|
||||
|
Loading…
Reference in New Issue
Block a user