Skip to content

Commit

Permalink
Add padding_token=eos_token for GPU trl QLora example (#12398)
Browse files Browse the repository at this point in the history
* Avoid tokenizer doesn't have a padding token error.
  • Loading branch information
qiyuangong authored Nov 14, 2024
1 parent d2cbcb0 commit 7e50ff1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
model_path = args.repo_id_or_model_path
dataset_path = args.dataset
tokenizer = LlamaTokenizer.from_pretrained(model_path, trust_remote_code=True)
# Avoid tokenizer doesn't have a padding token
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token

if dataset_path.endswith(".json") or dataset_path.endswith(".jsonl"):
data = load_dataset("json", data_files=dataset_path)
Expand Down

0 comments on commit 7e50ff1

Please sign in to comment.