From 463500f9c7fa98b4372d68376bfb0e4b0a919c5f Mon Sep 17 00:00:00 2001 From: Waleed Khalid Date: Sat, 3 Oct 2026 22:59:46 +0500 Subject: [PATCH 1/2] fix: Raise a clear error when HFSystemFormat's tokenizer has no chat template HFSystemFormat failed on every instance with the generic transformers ValueError when the model's tokenizer does not define a chat template. Check this once in prepare() and raise a UnitxtError naming the model and how to proceed: use a model with a chat template, pass one explicitly via chat_kwargs_dict={'chat_template': ...}, or use SystemFormat. Signed-off-by: Waleed Khalid --- src/unitxt/formats.py | 14 +++++++++++ tests/library/test_formats.py | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/unitxt/formats.py b/src/unitxt/formats.py index 0c0215ec08..9c4086e74c 100644 --- a/src/unitxt/formats.py +++ b/src/unitxt/formats.py @@ -528,6 +528,9 @@ class HFSystemFormat(ChatAPIFormat): See more details in https://huggingface.co/docs/transformers/main/en/chat_templating + If the tokenizer of the model does not define a chat template, a Jinja chat template can be passed explicitly: + ``HFSystemFormat(model_name=..., chat_kwargs_dict={"chat_template": "