From a29e3d6461698d24c4f29f5c45a6d423e8e1142f Mon Sep 17 00:00:00 2001 From: i-peixingyu Date: Tue, 19 May 2026 18:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20K100-vLLM-Patched-v2.0/pat?= =?UTF-8?q?ch.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- K100-vLLM-Patched-v2.0/patch.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 K100-vLLM-Patched-v2.0/patch.py diff --git a/K100-vLLM-Patched-v2.0/patch.py b/K100-vLLM-Patched-v2.0/patch.py new file mode 100644 index 0000000..b830d5a --- /dev/null +++ b/K100-vLLM-Patched-v2.0/patch.py @@ -0,0 +1,19 @@ +path = '/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py' +with open(path, 'r') as f: + content = f.read() + +old = (' self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES' + ' + list(special_tokens.keys())') +new = (' # PATCH: some models have extra_special_tokens as list instead of dict\n' + ' if isinstance(special_tokens, list):\n' + ' special_tokens = {t: t for t in special_tokens}\n' + ' self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES' + ' + list(special_tokens.keys())') + +if old in content: + content = content.replace(old, new) + with open(path, 'w') as f: + f.write(content) + print('Patch applied successfully') +else: + print('WARNING: pattern not found') \ No newline at end of file