Codync
免费开源的 1:1 Grok Bot 与 Muse 替代方案。可在 iPhone、Mac 或 Linux 桌面上将 Claude 代码、Codex、Cursor 以及 40 多个编码代理作为持久机器人使用。支持群组聊天、线程、应用。
AI 翻译
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Fast inference for LightGBM, XGBoost and CatBoost models, with predictions bit-identical to the library that trained them.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗pip install pylignum
import lignum
model = lignum.load("model.txt") # LightGBM, XGBoost or CatBoost file, detected from its content
preds = model.predict(X) # numpy, pandas, pyarrow, polars or a plain list
# == booster.predict(X), bit for bit
Installed as pylignum, imported as lignum. Wheels for Linux (x86_64, aarch64), macOS 15+
(arm64, x86_64) and Windows (x64); Python 3.10+.
predict bit for bit: NaN and
zero-as-missing, categorical splits, XGBoost's float32 arithmetic and CatBoost's CTRs included.
Named columns (pandas, Arrow) are checked against the model's feature names, so a reordered
DataFrame raises instead of predicting wrong. What the data scientist saw in the notebook is what
production returns.model.compile());
model.autotune(X) picks the faster one per batch size. One row of a 500-tree model takes
10-30 µs on one x86 core, 6-21 µs on an Apple M4.model.save("model.bin") writes a file that loads by memory mapping in under
a millisecond.predict reads pyarrow, polars and any Arrow PyCapsule object without copies; a
C API (include/lignum/c_api.h) serves other languages.The same models everywhere (500 rounds, 63 leaves; CatBoost depth 6), a different row on every call, AMD EPYC-Milan (Hetzner CCX33, 8 vCPU). LightGBM models, 1,000,000 rows on all threads and one row on one thread (median / p99):
| lignum | lleaves | TL2cgen | LightGBM | |
|---|---|---|---|---|
| California, 1M rows | 0.32 s | 0.48 s | 1.96 s | 3.56 s |
| Covertype, 1M rows | 1.57 s | 2.20 s | 34.5 s | 37.4 s |
| Diabetes, 1M rows | 0.75 s | 4.23 s | 31.9 s | 9.33 s |
| California, 1 row | 11.0 / 23.7 µs | 24.6 / 56.4 µs | 49.2 / 87.8 µs | 57.7 / 92.9 µs |
| Diabetes, 1 row | 13.3 / 34.2 µs | 77.6 / 118 µs | 280 / 365 µs | 82.5 / 121 µs |
| Covertype, compile | 22 s | 503 s | 70 s | — |
| Bit-identical | yes | no | yes | — |
Covertype has 7 classes (3,500 trees), Diabetes 130-US categorical features with hundreds of
values. lignum: the compiled mode for a million rows; for one row the faster of its two modes (the
interpreter on California, the compiled trees on Diabetes), which model.autotune(X) picks for you.
The interpreter needs no compiling and loads Covertype in 0.1 s. lleaves differs from LightGBM on
55-100% of the rows.
XGBoost models: 4-8x faster than XGBoost on a million rows and 5-15x on single rows (TL2cgen cannot load XGBoost 3 models trained on pandas categories, and is not bit-identical on the others). CatBoost models, from a pandas DataFrame: 1.2-3x faster on a million rows on one thread (2.3-2.7x on an Apple M4) and 8-27x on single rows (216x with high-cardinality categories).
lignum is not the fastest everywhere: on an Apple M4 lleaves predicts one Covertype row in 38 µs against lignum's 43 µs, and on x86 the compiled mode's p99 on single rows is worse than the interpreter's. All results: every data set, Apple M4, Arrow input, compile times, the methodology and how to reproduce them.
| Library | Files | Notes |
|---|---|---|
| LightGBM | model.txt, JSON | numeric and categorical splits, multiclass; not linear trees or random forests |
| XGBoost | JSON, UBJSON | float32 semantics, categorical splits, multiclass, DART; not multi-target models, gblinear or DART with dropped trees |
| CatBoost | .cbm, JSON | symmetric trees, one-hot and CTR categories, multiclass, Poisson / Tweedie; not Depthwise / Lossguide trees or text features |
Unsupported models are rejected at load time with a message that says why, never predicted wrongly.
misterekkk.github.io/lignum: getting started, model formats, CatBoost, the compiled mode, Arrow input, the C API, how exactness is guaranteed, and the Python reference. Release notes are in CHANGELOG.md.
lignum is young. If you use it, in production, research or a side project, please add yourself to ADOPTERS.md or tell us in an issue: it helps others decide and shapes what comes next.
Bug reports, models that lignum predicts differently from their library, and benchmark results from your hardware are all welcome. CONTRIBUTING.md explains the setup and the rules every change keeps (bit-exactness, measured performance, tests on three platforms); ARCHITECTURE.md describes the engine. Security problems: see SECURITY.md.
make venv && make py-build && make test # C++ (GoogleTest) + Python parity tests
lignum parses JSON models and numbers with simdjson.
Apache License 2.0. Versions up to 0.2.0 were released under the MIT License. If you use lignum in research, CITATION.cff has the citation.