-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evalscope perf 测试sglang 部署的openai api server 无法输出结果 #128
Comments
我们后面复现一下 |
您可以拉取main分支代码,来使用最新的perf模块尝试,参考使用指南。 |
测试mindie时遇到同样的问题 |
麻烦提供一下执行命令和--debug模式的控制台输出 |
我在使用evalscope 最新版本 0.8.1压测sglang部署的大模型报如下错误: # evalscope perf --url "http://192.168.171.166:21840/v1/chat/completions" --parallel 1 --model Qwen2.5-14B-Instruct --number 30 --max-tokens 2048 --temperature 0.7 --api openai --dataset openqa --stream
报错信息如下:
2024-12-25 09:57:13,439 - evalscope - http_client.py - _handle_stream - 52 - DEBUG - Response recevied: data: [DONE]
Processing: 0it [00:01, ?it/s]
2024-12-25 09:57:13,440 - evalscope - handler.py - async_wrapper - 19 - ERROR - Exception in async function 'statistic_benchmark_metric_worker': 'object'
Traceback (most recent call last):
File "/home/user/anaconda3/envs/evalscope/lib/python3.10/site-packages/evalscope/perf/utils/handler.py", line 17, in async_wrapper
return await func(*args, **kwargs)
File "/home/user/anaconda3/envs/evalscope/lib/python3.10/site-packages/evalscope/perf/benchmark.py", line 167, in statistic_benchmark_metric_worker
metrics.update_metrics(benchmark_data, api_plugin)
File "/home/user/anaconda3/envs/evalscope/lib/python3.10/site-packages/evalscope/perf/utils/benchmark_util.py", line 86, in update_metrics
benchmark_data._calculate_tokens(api_plugin)
File "/home/user/anaconda3/envs/evalscope/lib/python3.10/site-packages/evalscope/perf/utils/benchmark_util.py", line 43, in _calculate_tokens
api_plugin.parse_responses(self.response_messages, request=self.request)
File "/home/user/anaconda3/envs/evalscope/lib/python3.10/site-packages/evalscope/perf/plugin/api/openai_api.py", line 116, in parse_responses
if js['object'] == 'chat.completion':
KeyError: 'object' 问题应该是使用了stream流式输出导致的问题,不启用流式输出压测是正常的。 |
我们复现并修复一下 |
这是因为sglang的api返回有这种没带object的数据 data: {"id":"89467d81d1ea4435b74a34651faeedb4","model":"Qwen2.5-14B-Instruct","choices":[],"usage":{"prompt_tokens":44,"total_tokens":328,"completion_tokens":284}} 这种没有带object需要处理一下,我改了一下perf/plugin/api/openai_api.py文件中的parse_responses方法,判断接收的数据是否包含object属性,没有的话补一下就可以了。
|
it would be great it you just submit a pull-request :) |
哈哈,我尝试提了一个pull-request #260 @yingdachen |
merged ~ you can pull the main branch and perform regression testing :) |
版本:evalscope 0.5.3
sglang 0.3.0
在本地起了一个sglang的openai api server,命令如下:
CUDA_VISIBLE_DEVICES=4,5,6,7 python -m sglang.launch_server --model-path /local/models/Qwen2-72B-Instruct --tp 4 --host 0.0.0.0
能够正常访问,用下面的语句进行benchmark测试:
evalscope perf --url 'http://localhost:30000/v1/chat/completions' --parallel 128 --model '/local/models/Qwen2-72B-Instruct' --log-every-n-query 10 --read-timeout=120 --dataset-path './dataset/open_qa.jsonl' -n 50 --max-prompt-length 128000 --api openai --stream --stop '<|im_end|>' --dataset openqa --debug
server端有输出:
测试脚本到这个位置就不动了
同样的命令在测试vllm时可以正常输出结果,但是测试sglang时无法生成结果。
麻烦帮忙看看问题出在哪里,多谢
The text was updated successfully, but these errors were encountered: