Skip to content

使用 evalscope perf进行性能压测时使用内置数据集kontext_bench报错 KeyError: 'instruction' #1225

@balala21

Description

@balala21

问题描述
在使用 evalscope perf 对多模态模型进行性能压测时,指定使用内置数据集 --dataset kontext_bench 会触发 KeyError: 'instruction' 错误。

EvalScope 版本 1.5.0
Python版本:3.10

执行指令
Bash
evalscope perf
--model ./step3_w4a8_TN
--url http://localhost:8000/v1/chat/completions
--api-key "EMPTY"
--parallel 8
--number 10
--dataset kontext_bench
--tokenizer-path ./step3_w4a8_TN
--extra-args '{"ignore_eos": true}'

错误日志
Python
DEBUG - Dataset Schema: {'image': Image(mode=None, decode=True, id=None)}
DEBUG - Item structure: {'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=3024x4032 at 0x7FECE2B5F3A0>}
2026-03-13 12:58:20 - evalscope - ERROR: Exception in async function 'benchmark': 'instruction'
Traceback (most recent call last):
File ".../evalscope/perf/utils/handler.py", line 17, in async_wrapper
return await func(*args, **kwargs)
File ".../evalscope/perf/benchmark.py", line 185, in benchmark
async for request in get_requests(args, api_plugin):
File ".../evalscope/perf/benchmark.py", line 81, in get_requests
async for request in generator:
File ".../evalscope/perf/benchmark.py", line 51, in _generate_from_dataset
for messages in pbar:
File ".../evalscope/perf/plugin/datasets/kontext_bench.py", line 25, in build_messages
text = item['instruction']
KeyError: 'instruction'

经过初步调试分析发现:
通过 MsDataset.load 加载的 black-forest-labs/kontext-bench 数据集在当前环境下返回的 Schema 仅包含 image 字段,丢失了文本元数据。即使 ModelScope 官网显示该数据集包含 instruction 字段,但 evalscope 内部加载后的 item 结构为 {'image': <PIL.JpegImageFile ...>}。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions