open-compass / open-compass/opencompass
[Bug] Qwen3.5 cannot run when using HuggingFacewithChatTemplate
@tonysy is already working on this.
Since Jul 31, 2026.
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 869
- Avg merge
- 17h 52m
- Merged PRs (30d)
- 13
Description
Prerequisite
- I have searched Issues and Discussions but cannot get the expected help.
- The bug has not been fixed in the latest version.
Type
I'm evaluating with the officially supported tasks/models/datasets.
Environment
The environment is as follows. The hardware is not correct, you may only check the python environment.
{'CUDA available': False,
'GCC': 'gcc (Debian 12.2.0-14+deb12u1) 12.2.0',
'MMEngine': '0.10.7',
'MUSA available': False,
'OpenCV': '5.0.0',
'PyTorch': '2.11.0+cu129',
'PyTorch compiling details': 'PyTorch built with:\n'
' - GCC 13.3\n'
' - C++ Version: 201703\n'
' - Intel(R) oneAPI Math Kernel Library Version '
'2024.2-Product Build 20240605 for Intel(R) 64 '
'architecture applications\n'
' - Intel(R) MKL-DNN v3.10.2 (Git Hash '
'f1d471933dc852f956fd05389f9313c7148783d5)\n'
' - OpenMP 201511 (a.k.a. OpenMP 4.5)\n'
' - LAPACK is enabled (usually provided by '
'MKL)\n'
' - NNPACK is enabled\n'
' - CPU capability usage: AVX512\n'
' - Build settings: BLAS_INFO=mkl, '
'BUILD_TYPE=Release, '
'COMMIT_SHA=70d99e998b4955e0049d13a98d77ae1b14db1f45, '
'CUDA_VERSION=12.9, CUDNN_VERSION=9.17.1, '
'CXX_COMPILER=/opt/rh/gcc-toolset-13/root/usr/bin/c++, '
'CXX_FLAGS= -fvisibility-inlines-hidden '
'-DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO '
'-DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON '
'-DUSE_FBGEMM -DUSE_MSLK -DUSE_PYTORCH_QNNPACK '
'-DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE '
'-O2 -fPIC -DC10_NODEPRECATED -Wall -Wextra '
'-Werror=return-type -Werror=non-virtual-dtor '
'-Werror=range-loop-construct '
'-Werror=bool-operation -Wnarrowing '
'-Wno-missing-field-initializers '
'-Wno-unknown-pragmas -Wno-unused-parameter '
'-Wno-strict-overflow -Wno-strict-aliasing '
'-Wno-stringop-overflow -Wsuggest-override '
'-Wno-psabi -Wno-error=old-style-cast '
'-faligned-new -Wno-maybe-uninitialized '
'-fno-math-errno -fno-trapping-math '
'-Werror=format -Wno-dangling-reference '
'-Wno-error=dangling-reference '
'-Wno-stringop-overflow, LAPACK_INFO=mkl, '
'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
'TORCH_VERSION=2.11.0, USE_CUDA=ON, '
'USE_CUDNN=ON, USE_CUSPARSELT=1, USE_GFLAGS=OFF, '
'USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, '
'USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, '
'USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, '
'USE_ROCM_KERNEL_ASSERT=OFF, USE_XCCL=OFF, '
'USE_XPU=OFF, \n',
'Python': '3.12.7 | packaged by Anaconda, Inc. | (main, Oct 4 2024, '
'13:27:36) [GCC 11.2.0]',
'TorchVision': '0.26.0+cu129',
'lmdeploy': "not installed:No module named 'lmdeploy'",
'numpy_random_seed': np.uint32(2147483648),
'opencompass': '0.5.3+',
'sys.platform': 'linux',
'transformers': '5.12.1'}
Reproduces the problem - code/configuration sample
from opencompass.models import HuggingFacewithChatTemplate
from opencompass.tasks import OpenICLInferTask, OpenICLEvalTask
from opencompass.partitioners import SizePartitioner, NaivePartitioner
from opencompass.runners import LocalRunner
from mmengine.config import read_base
from opencompass.utils.text_postprocessors import extract_non_reasoning_content
with read_base():
from opencompass.configs.datasets.ceval.ceval_gen import ceval_datasets
datasets = [
*ceval_datasets
]
model_path = "Qwen/Qwen3.5-4B"
model_tag = model_path.split('/')[-1]
work_dir = f'outputs/{model_tag}'
models = [
dict(
abbr=model_tag,
type=HuggingFacewithChatTemplate,
path=model_path,
tokenizer_path=model_path,
max_out_len=8192,
max_seq_len=32768,
generation_kwargs=dict(
temperature=0.7,
top_p=0.8,
top_k=20,
min_p=0.0,
presence_penalty=1.5,
repetition_penalty=1.0,
do_sample=True,
),
model_kwargs=dict(
device_map='auto',
trust_remote_code=True,
torch_dtype='torch.bfloat16',
),
batch_size=8,
run_cfg=dict(num_gpus=1),
pred_postprocessor=dict(type=extract_non_reasoning_content)
)
]
infer = dict(
partitioner=dict(
type=SizePartitioner,
max_task_size=1000,
strategy='split',
),
runner=dict(
type=LocalRunner,
max_num_workers=1,
task=dict(type=OpenICLInferTask)
),
)
eval = dict(
partitioner=dict(type=NaivePartitioner, n=16),
runner=dict(type=LocalRunner, max_num_workers=32, task=dict(type=OpenICLEvalTask)))
summarizer = dict(
dataset_abbrs=[
'ceval',
'ceval-hard',
'ceval-stem',
'ceval-social-science',
'ceval-humanities',
'ceval-other'
],
summary_groups=sum(
[v for k, v in locals().items() if k.endswith('_summary_groups')], []),
)
Reproduces the problem - command or script
opencompass test.py
Reproduces the problem - error message
Traceback (most recent call last):
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/tasks/openicl_infer.py", line 177, in <module>
inferencer.run()
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/tasks/openicl_infer.py", line 103, in run
self._inference()
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/tasks/openicl_infer.py", line 155, in _inference
inferencer.inference(retriever,
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/openicl/icl_inferencer/icl_gen_inferencer.py", line 177, in inference
results = self.model.generate_from_template(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/models/base.py", line 201, in generate_from_template
return self.generate(inputs, max_out_len=max_out_len, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/opencompass/models/huggingface_above_v4_33.py", line 445, in generate
tokens = self.tokenizer.batch_encode_plus(messages, **tokenize_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/bn/woker/anaconda3/envs/llm_backup/lib/python3.12/site-packages/transformers/tokenization_utils_base.py", line 1316, in __getattr__
raise AttributeError(f"{self.__class__.__name__} has no attribute {key}")
AttributeError: Qwen2Tokenizer has no attribute batch_encode_plus. Did you mean: '_encode_plus'?
Other information
I am using Qwen3.5-4B and ceval dataset with HF backend. The code raises AttributeError: Qwen2Tokenizer has no attribute batch_encode_plus. Did you mean: '_encode_plus'?. I find the batch_encode_plus is deprecated after transformers 5.x.x. However, the Qwen3.5 is supported after transformers 5.2.0. I suppose the way to solve this is to change the old API call.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.