LLM-Math
基于 math-evaluation-harness 改造的 plug-and-play 数学评测包.
Usage
-
set_seed(seed)设置全局种子.
-
basic_check(A, B)检查 A, B 两个纯数学表达式是否一致,返回 True / False.
-
check(prompt_type, data_name, target, pred)检查 pred 是否与 target 一致,返回 True / False. target 即为数据集的某一行.
-
engine = MathEval(model_path, args)加载模型,args 为加载参数,见 vllm.LLM.
-
engine.set_sampling_args(args)设定推理参数,再次使用该命令可更新参数,见 vllm.SamplingParams.
-
results = engine.generate(inputs)进行批量推理.
-
results = engine.chat(messages)进行单次对话.
-
engine.test(datasets=["gsm8k", "math"], prompt_type="direct", args)进行评测. 可用的参数:
prompt_type="cot": prompt 的类型设置.split="test": 测试集的选取.num_test_sample=-1, 随机选取进行测试的数量.shuffle=True, 是否随机打乱测试集.save_outputs=True, 是否保存模型输出.
-
支持的 prompt 类型:
tool-integrated,direct,cot,pal,self-instruct,self-instruct-boxed,tora,wizard_zs,platypus_fs,deepseek-math,kpmath. -
支持的数据集:
gsm8k,math,svamp,asdiv,mawps,tabmwp,mathqa,mmlu_stem,sat_math.
Notes
-
模型需支持 vLLM.
-
在
set_sampling_args中设定的 stop_word 在test中不起作用. -
由于设置全局种子也会设定模型加载和推理的种子,所以模型加载和推理时不需要再次设定种子.
-
tensor_parallel_size默认设为torch.cuda.device_count().
Metadata
Release files for llm_math 0.2.0
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 | |
|---|---|---|---|---|
| llm_math-0.2.0.tar.gz | 6.5 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_math-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.1 MB
Release files / llm_math-0.2.0.tar.gz
| Download URL | llm_math-0.2.0.tar.gz |
|---|---|
| Size | 6.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
053f3619c3b4beb02ae482f8284d9ed9a3f25c38c01527b262020ff45e3a63e8
|
|
BLAKE2b-256 checksum How to use checksums |
13123650a5fab63fafd2127505a64ca538390802bc62884c670621a03d572502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.19.1 CPython/3.9.19 Darwin/24.1.0
|
Release files / llm_math-0.2.0-py3-none-any.whl
| Download URL | llm_math-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
716d745fca35076691781c640a709362d79410b64b67a102868c54595d1e601c
|
|
BLAKE2b-256 checksum How to use checksums |
24cf311f026e517ebf120f11e8fd9da83e74cf24db76011828e299db0784ffc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.19.1 CPython/3.9.19 Darwin/24.1.0
|
Security for llm_math 0.2.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.