fix: chat_templates.py bug (#1048)
* fix: chat_template bug * fix: check trainer attribute values are not None
This commit is contained in:
parent
c247bfc72c
commit
02cc97e388
1 changed files with 3 additions and 3 deletions
|
|
@ -1842,10 +1842,10 @@ def train_on_responses_only(
|
|||
return { "labels" : all_labels }
|
||||
pass
|
||||
|
||||
if hasattr(trainer, "train_dataset"):
|
||||
if hasattr(trainer, "train_dataset") and trainer.train_dataset is not None:
|
||||
trainer.train_dataset = trainer.train_dataset.map(_train_on_responses_only, batched = True)
|
||||
if hasattr(trainer, "eval_dataset"):
|
||||
trainer.eval_dataset = trainer.eval_dataset .map(_train_on_responses_only, batched = True)
|
||||
if hasattr(trainer, "eval_dataset") and trainer.eval_dataset is not None:
|
||||
trainer.eval_dataset = trainer.eval_dataset.map(_train_on_responses_only, batched = True)
|
||||
return trainer
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue