From 4e16a70be3f231edbc17c1229a585434b51a2d8d Mon Sep 17 00:00:00 2001 From: tastelikefeet <58414341+tastelikefeet@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:16:24 +0800 Subject: [PATCH] fix some transformers version missing the chat template definition (#1368) --- modelscope/utils/hf_util/patcher.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modelscope/utils/hf_util/patcher.py b/modelscope/utils/hf_util/patcher.py index 0174cf93..418f65f3 100644 --- a/modelscope/utils/hf_util/patcher.py +++ b/modelscope/utils/hf_util/patcher.py @@ -243,13 +243,12 @@ def _patch_pretrained_class(all_imported_modules, wrap=False): from transformers.tokenization_utils import SPECIAL_TOKENS_MAP_FILE from transformers.tokenization_utils import TOKENIZER_CONFIG_FILE from transformers.tokenization_utils_base import FULL_TOKENIZER_FILE - from transformers.tokenization_utils_base import CHAT_TEMPLATE_FILE extra_allow_file_pattern = list( (cls.vocab_files_names.values()) if cls is not None and hasattr(cls, 'vocab_files_names') else []) + [ ADDED_TOKENS_FILE, SPECIAL_TOKENS_MAP_FILE, TOKENIZER_CONFIG_FILE, FULL_TOKENIZER_FILE, - CHAT_TEMPLATE_FILE, r'*.py' + 'chat_template.jinja', r'*.py' ] # noqa elif 'Processor' in module_class.__name__: from transformers.utils import FEATURE_EXTRACTOR_NAME