安装指南¶
本文说明如何安装并使用 Probing(PyPI 或本地 wheel)。
在仓库里改代码、跑测试请直接看 贡献指南 — 开发环境,使用 make develop,不要只按本文装 wheel。
环境要求¶
| 组件 | 版本 |
|---|---|
| Python | 3.8+ |
| Rust(仅源码构建) | 1.95+,stable 通道 — 见 贡献指南 — 前提条件 |
| 操作系统(完整功能) | Linux — probing inject 需要 |
| 操作系统(仅进程内) | macOS / Windows — 启动时 PROBING=1,CLI query/eval 可用 |
从 PyPI 安装(推荐)¶
验证:
在训练任务中启用 probing¶
安装后,wheel 自带 site hook(probing.pth → probing_hook.py):设置 PROBING 环境变量即可自动 import probing,无需改训练脚本。
常用取值:
PROBING |
行为 |
|---|---|
未设置 / 0 |
关闭(默认) |
1 / followed |
当前进程启用 |
2 / nested |
当前进程及子进程启用 |
regex:PATTERN |
脚本名匹配正则时启用 |
SCRIPT.py |
脚本 basename 完全匹配时启用 |
高级过滤与 init:… 前缀见仓库内 python/probing/site_hook.py。
在 Linux 上还可 attach 已运行进程:
macOS / Windows 请在启动时设置 PROBING=1(或 2);不支持 inject。
从源码构建 wheel 安装¶
适用于 CI 冒烟或本地验 wheel — 不是日常改仓库代码的方式(请用 make develop)。
需要 Rust stable 及可选的前端工具链 — 见 贡献指南 — 前提条件。
git clone https://github.com/DeepLink-org/probing.git
cd probing
# 若尚未安装 Rust stable,见 contributing.zh.md#prerequisites
make frontend
make wheel
pip install dist/probing-*.whl --force-reinstall
# 或:make install-wheel
验证方式同上。本地 wheel 与 PyPI 一样包含 site hook。
平台支持¶
| 平台 | probing inject |
进程内(PROBING=1) |
CLI query / eval |
|---|---|---|---|
| Linux | ✅ | ✅ | ✅ |
| macOS | ❌ | ✅ | ✅ |
| Windows | ❌ | ✅ | ✅ |
升级¶
版本与 PyTorch / NCCL 兼容性见 版本说明。
可选:示例与 ML 依赖¶
核心包无强制 Python 依赖。examples/ 下的示例可能需要额外安装(如 torch、torchvision),见 examples/README.md。