From 4229c03db5be092e4c852e3e6fcf136e7ef6efd3 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 26 Nov 2024 14:37:20 +0100 Subject: [PATCH] fix slow CI --- tests/slow/test_sft_slow.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/slow/test_sft_slow.py b/tests/slow/test_sft_slow.py index b0c0a3364c..6088d1a3de 100644 --- a/tests/slow/test_sft_slow.py +++ b/tests/slow/test_sft_slow.py @@ -104,7 +104,7 @@ def test_sft_trainer_transformers(self, model_name, packing): model = AutoModelForCausalLM.from_pretrained(model_name) tokenizer = AutoTokenizer.from_pretrained(model_name) - + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, args=training_args, @@ -138,6 +138,7 @@ def test_sft_trainer_peft(self, model_name, packing): model = AutoModelForCausalLM.from_pretrained(model_name) tokenizer = AutoTokenizer.from_pretrained(model_name) + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, @@ -174,6 +175,7 @@ def test_sft_trainer_transformers_mp(self, model_name, packing): model = AutoModelForCausalLM.from_pretrained(model_name) tokenizer = AutoTokenizer.from_pretrained(model_name) + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, @@ -209,7 +211,7 @@ def test_sft_trainer_transformers_mp_gc(self, model_name, packing, gradient_chec model = AutoModelForCausalLM.from_pretrained(model_name) tokenizer = AutoTokenizer.from_pretrained(model_name) - + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, args=training_args, @@ -245,7 +247,7 @@ def test_sft_trainer_transformers_mp_gc_peft(self, model_name, packing, gradient model = AutoModelForCausalLM.from_pretrained(model_name) tokenizer = AutoTokenizer.from_pretrained(model_name) - + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, args=training_args, @@ -288,6 +290,7 @@ def test_sft_trainer_transformers_mp_gc_device_map( model = AutoModelForCausalLM.from_pretrained(model_name, device_map=device_map) tokenizer = AutoTokenizer.from_pretrained(model_name) + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, @@ -327,7 +330,7 @@ def test_sft_trainer_transformers_mp_gc_peft_qlora(self, model_name, packing, gr model = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=quantization_config) tokenizer = AutoTokenizer.from_pretrained(model_name) - + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token trainer = SFTTrainer( model, args=training_args, @@ -369,8 +372,9 @@ def test_sft_trainer_with_chat_format_qlora(self, model_name, packing): model = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=quantization_config) tokenizer = AutoTokenizer.from_pretrained(model_name) - - model, tokenizer = setup_chat_format(model, tokenizer) + tokenizer.pad_token = tokenizer.eos_token if tokenizer.pad_token is None else tokenizer.pad_token + if tokenizer.chat_template is None: + model, tokenizer = setup_chat_format(model, tokenizer) trainer = SFTTrainer( model,