diff --git a/tests/models/bloom/test_tokenization_bloom.py b/tests/models/bloom/test_tokenization_bloom.py index a477d2538c7c67..068886d0d829bd 100644 --- a/tests/models/bloom/test_tokenization_bloom.py +++ b/tests/models/bloom/test_tokenization_bloom.py @@ -135,6 +135,7 @@ def test_encodings_from_xnli_dataset(self): @require_jinja def test_tokenization_for_chat(self): tokenizer = self.get_rust_tokenizer() + tokenizer.chat_template = "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}" test_chats = [ [{"role": "system", "content": "You are a helpful chatbot."}, {"role": "user", "content": "Hello!"}], [ diff --git a/tests/models/gpt2/test_tokenization_gpt2.py b/tests/models/gpt2/test_tokenization_gpt2.py index 975ede8faf377d..379485fd5623c6 100644 --- a/tests/models/gpt2/test_tokenization_gpt2.py +++ b/tests/models/gpt2/test_tokenization_gpt2.py @@ -280,7 +280,7 @@ def test_special_tokens_mask_input_pairs_and_bos_token(self): @require_jinja def test_tokenization_for_chat(self): tokenizer = GPT2Tokenizer.from_pretrained(self.tmpdirname) - tokenizer.chat_template = '{% for message in messages %}{{ message.content }}{{ eos_token }}{% endfor %}' + tokenizer.chat_template = "{% for message in messages %}{{ message.content }}{{ eos_token }}{% endfor %}" test_chats = [ [{"role": "system", "content": "You are a helpful chatbot."}, {"role": "user", "content": "Hello!"}], [