mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-09-01 12:49:50 +08:00
Add eos token to lora fine-tunes (#818)
* add eos token to lora fine-tunes * Comment
This commit is contained in:
@@ -92,6 +92,12 @@ def iterate_batches(dataset, tokenizer, batch_size, max_seq_length, train=False)
|
||||
for i in indices:
|
||||
# Encode batch
|
||||
batch = [tokenizer.encode(dataset[j]) for j in batch_idx[i]]
|
||||
for b in batch:
|
||||
if b[-1] == tokenizer.eos_token_id:
|
||||
print("[WARNING] Example already has an EOS token appended")
|
||||
else:
|
||||
b.append(tokenizer.eos_token_id)
|
||||
|
||||
lengths = [len(x) for x in batch]
|
||||
|
||||
if max(lengths) > max_seq_length:
|
||||
|
Reference in New Issue
Block a user