From 83ed41ee761001b36d4b79a674db21e616e79750 Mon Sep 17 00:00:00 2001 From: peixingyu Date: Fri, 24 Apr 2026 07:43:54 +0000 Subject: [PATCH] Add Biren166M vllm patch-tokenizer image --- Dockerfile | 4 ++++ patch.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Dockerfile create mode 100644 patch.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b49a1c7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM git.modelhub.org.cn:9443/enginex/xc-llm-biren166m:26.01 + +COPY patch.py /tmp/patch.py +RUN python3 /tmp/patch.py diff --git a/patch.py b/patch.py new file mode 100644 index 0000000..5aa6ea5 --- /dev/null +++ b/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')