Skip to content

[Bug] 性能测试报错 Error encoding input data: No module named 'encoding_dsv4',导致 InputTokens 全部为 0 #497

Description

@Hjasongit

操作系统及版本

vllm-ascend 0.21.rc
openEuler 5.10内核

安装工具的python环境

工具安装路径/opt/aisbench-venv,python3.12

python版本

3.12

AISBench工具版本

3.0.0

AISBench执行命令

ais_bench --models vllm_api_stream_chat --datasets gsm8k_gen_0_shot_cot_str_perf --mode perf --num-prompts 4
关键参数:concurrency=1, requestRate=0, inputLen=4096, maxOutLen=1024, SERVER_HTTP_IP=127.0.0.1

模型配置文件或自定义配置文件内容

from ais_bench.benchmark.models import VLLMCustomAPIChatStream
from ais_bench.benchmark.utils.model_postprocessors import extract_non_reasoning_content

models = [
    dict(
        attr="service",
        type=VLLMCustomAPIChatStream,
        abbr='vllm-api-stream-chat',
        path="/workspace/models/",
        model="DEEPSEEK-V4",
        request_rate = 0,
        retry = 2,
        host_ip = "127.0.0.1",
        host_port = 8000,
        max_out_len = 1024,
        batch_size = 2,
        trust_remote_code=False,
        generation_kwargs = dict(
            temperature = 0,
            #top_k = -1,
            #top_p = 1,
            #seed = None,
            #repetition_penalty = 1,
			#max_tokens = 2048,
			#min_tokens = 2048,
			ignore_eos = True,
        ),
        pred_postprocessor=dict(type=extract_non_reasoning_content)
    )
]

预期行为

性能测试推理阶段正常完成(4/4 请求成功,每条输出 1024 token),encode_input_data 应能正确统计输入 token 数,InputTokens 应反映实际的 4096 长度 prompt 的 token 数,而非全部为 0。

实际行为

推理正常完成,但随后 encode_input_data 报错 No module named 'encoding_dsv4',导致 InputTokens 全部被置为 0,性能报告中的输入 token 相关指标全部失真:

08/14 01:45:22 - AISBench - ERROR - /opt/aisbench-venv/lib/python3.12/site-packages/ais_bench/benchmark/models/performance_api.py - encode_input_data - 81 - Error encoding input data: No module named 'encoding_dsv4'

该错误重复出现 4 次(对应 4 条 prompt),但流程未被中断,最终性能结果表中:

│ InputTokens             │ total │ 0.0             │ 0.0  │ 0.0  │ 0.0  │ ... │  4  │
│ OutputTokens            │ total │ 1024.0          │ 1024 │ 1024 │ 1024 │ ... │  4  │
│ Total Input Tokens      │ total │ 0               │
│ Total generated tokens  │ total │ 4096            │
│ Input Token Throughput  │ total │ 0.0 token/s     │
│ Output Token Throughput │ total │ 52.0263 token/s │

OutputTokens 正常为 1024,Total generated tokens 为 4096,说明推理本身成功,仅输入 token 统计因模块缺失而失败。

目前好规避方案是通过huggingface下载dsv4的encoding_dsv4.py文件,修改vllm_custom_api_chat.py代码

# 修复前
encoding_dir = os.path.join(self.path, "encoding")
# 修复后
encoding_dir = os.environ.get("DSV4_ENCODING_DIR") or os.path.join(self.path, "encoding")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions