From 9ae17aec21424e727f23ce414aa5637af93a8228 Mon Sep 17 00:00:00 2001 From: Far El <36641995+pharaouk@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:19:34 -0400 Subject: [PATCH] Fix falcon tokenization step (#1441) [skip ci] * Fix falcon tokenization step * chore: lint --------- Co-authored-by: Wing Lian --- src/axolotl/utils/trainer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/axolotl/utils/trainer.py b/src/axolotl/utils/trainer.py index 380264a7ac..d68681afe3 100644 --- a/src/axolotl/utils/trainer.py +++ b/src/axolotl/utils/trainer.py @@ -124,9 +124,10 @@ def process_datasets_for_packing(cfg, train_dataset, eval_dataset): eval_dataset = eval_dataset.remove_columns("attention_mask") if cfg.model_config_type == "falcon": - LOG.info("dropping token_type_ids column") - train_dataset = train_dataset.remove_columns("token_type_ids") - if eval_dataset: + LOG.info("dropping token_type_ids column if it exists") + if "token_type_ids" in train_dataset.column_names: + train_dataset = train_dataset.remove_columns("token_type_ids") + if eval_dataset and "token_type_ids" in eval_dataset.column_names: eval_dataset = eval_dataset.remove_columns("token_type_ids") train_dataset = train_dataset.filter(