LLM 推理服务基准测试
本仓库包含了测试常见推理服务吞吐的代码以及相关的测试结果。
安装说明
基础环境
- Python 3.9 或以上版本
- Poetry (非必须)
请使用以下命令安装 Poetry:
pip install poetry
运行方式
[通过 pip 线上安装运行]
pip install ai_benchmarks
run-benchmark -h
run-app
[通过 pip手动构建安装运行]
-
构建包或以其他方式获取:
cd ai-benchmarks && poetry build
-
安装包:
pip install ai_benchmarks-x.x.x.tar.gz
-
接口运行方式:
- 启动后可访问 127.0.0.1:8012/docs 查看接口文档。
run-app
-
直接运行方式,-h查看帮助,默认执行配置文件默认测试端点:
run-benchmark -h
[通过代码运行]
-
安装依赖:
cd ai-benchmarks poetry安装 poetry lock && poetry install requirements安装 pip install -i https://mirrors.aliyun.com/pypi/simple/ -r .\requirements.txt
-
benchmark.py是主要的压测脚本,采用 asyncio、AsyncOpenAI 和 ProcessPoolExecutor等 实现多端压测框架。 -
直接运行压测:
poetry run python -m inference.benchmark
-
启动接口压测:
- 启动后可访问 127.0.0.1:8012/docs 查看接口文档。
poetry run python -m inference.main
-
测试报告和结果:
- 测试报告输出到
inference/report文件夹。 - 原始测试结果数据输出到
inference/results文件夹,可使用draw.ipynb进行绘图。
- 测试报告输出到
配置文件说明
[section] # 支持多section
endpoint: # *必须提供一个有效的 endpoint
api_key: # 认证KEY
concurrent_requests: # 同时并发的请求数
batch: # 执行批次
duration_enabled: # 启用持续请求的时间限制(开启后不执行 concurrent_requests)[True/False]
duration_time: # 请求持续时间,默认为 1 秒
duratio_interval: # 持续/请求间隔,默认0.2秒
duration_batch: # 请求持续时间内每次并发数量,默认为 10
ip: # 用户查询机器资源占用
username: # 用户名
password: # 密码
timeout: # 超时时间,默认 60 秒
max_retries: # 最大重试次数,默认 1
max_connections: # 最大连接数
max_keepalive_connections: # 最大保持活动连接数
model: # 自动获取,可手动添加
owned_by: # 自动获取,可手动添加
stream: # 流式回复默认关闭[True/False]
prompts: # 问题, 为空自动匹配默认问题, 格式 [{"id": 1, "prompt": "Output from 1 to 100"}, {"id": 2, "prompt": "List the top 10 most important people in history."},]
Metadata
Release files for ai-benchmarks 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ai_benchmarks-0.1.6.tar.gz | 4.2 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_benchmarks-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 MB
Release files / ai_benchmarks-0.1.6.tar.gz
| Download URL | ai_benchmarks-0.1.6.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35f4208f5b654901ce027c04863e54d8c4d874a1170deecadb7e167ba0734b1f
|
|
BLAKE2b-256 checksum How to use checksums |
e840c27e0270941d03f6b466ea7723978572c9f43f6cce97155352b7fed38623
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.1 Windows/11
|
Release files / ai_benchmarks-0.1.6-py3-none-any.whl
| Download URL | ai_benchmarks-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b40f3729da47c2503d5ae6a3f7386fcd01e27c93d0f25ed9e825765f0826c1d
|
|
BLAKE2b-256 checksum How to use checksums |
ad7e91daf5dde4b51887cba1e562e4a3debd7b0df14abe0c755eb742dec494fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.1 Windows/11
|
Security for ai-benchmarks 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.