Skip to content

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

Closed

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

  1. github-actions commented on Aug 26, 2026

    @github-actions

    🌟欢迎给AISBench benchmark测评工具提issue,我们会尽快处理您的诉求~

  2. github-actions commented on Aug 26, 2026

    @github-actions

    🤖 基于AI机器人的issue内容完整性检查结果:

    问题内容检查结果

    检查状态

    PASS

    详细检查

    • 操作系统及版本: COMPLETE
    • 安装工具的python环境: COMPLETE
    • python版本: COMPLETE

    👉 如果想重新检查,在评论区@issue_checker即可。

    【强烈推荐❤️‍🔥】确保issue描述完整后,可以试着将issue交给Ask DeepWiki回答,deepwiki包含了和工具相关的所有知识库

  3. github-actions commented on Aug 26, 2026

    @github-actions

    🤖 基于AI机器人的issue内容完整性检查结果:

    问题内容检查结果

    检查状态

    PASS

    详细检查

    • 操作系统及版本: COMPLETE
    • 安装工具的python环境: COMPLETE
    • python版本: COMPLETE
    • AISBench工具版本: COMPLETE
    • AISBench执行命令: COMPLETE
    • 模型配置文件或自定义配置文件内容: COMPLETE
    • 实际行为: COMPLETE

    改进建议

    所有内容已完备!

    补充说明

    该 issue 内容非常详细和完整,不仅包含了所有要求的必填信息,还额外提供了“预期行为”和临时的“规避方案”,这对于问题的诊断和解决非常有帮助。日志输出和性能指标的对比也清晰地展示了问题的影响。

    👉 如果想重新检查,在评论区@issue_checker即可。

    【强烈推荐❤️‍🔥】确保issue描述完整后,可以试着将issue交给Ask DeepWiki回答,deepwiki包含了和工具相关的所有知识库

  4. jschen069 commented on Sep 23, 2026

    @jschen069
    Collaborator

    1、aisbench使用版本较老,现在inputtoken逻辑已更改为从vllm 中的usage.prompt_tokens获取inputtoken,若非0,则直接落盘到detail.json。然后汇总到cli展示台中,请再测试验证下。

    Image
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