From a9ff8c975f558e28b2614810da0efa4992fbacf9 Mon Sep 17 00:00:00 2001 From: dfei <913015993@qq.com> Date: Thu, 24 Apr 2025 11:13:38 +0800 Subject: [PATCH] When the chat_template is not set in the YAML configuration file, the program crashes unexpectedly. --- src/open_r1/utils/model_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/open_r1/utils/model_utils.py b/src/open_r1/utils/model_utils.py index 8191c17ea..d9ec806e0 100644 --- a/src/open_r1/utils/model_utils.py +++ b/src/open_r1/utils/model_utils.py @@ -14,7 +14,7 @@ def get_tokenizer(model_args: ModelConfig, training_args: SFTConfig | GRPOConfig trust_remote_code=model_args.trust_remote_code, ) - if training_args.chat_template is not None: + if hasattr(training_args, 'chat_template') and training_args.chat_template is not None: tokenizer.chat_template = training_args.chat_template return tokenizer