Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/xiaobei930/cc-best/infergit clone --depth 1 https://github.com/xiaobei930/cc-bestWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/xiaobei930/cc-best/infer)<a href="https://agentmods.dev/commands/xiaobei930/cc-best/infer"><img src="https://agentmods.dev/badge/commands/xiaobei930/cc-best/infer.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00005 | $0.00688 |
| Opus 5 | $0.00003 | $0.00344 |
| Sonnet 5 | $0.00001 | $0.00138 |
| Haiku 4.5 | $0.00001 | $0.00069 |
Grade A, and why
infer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
/infer - 模型推理
运行机器学习/深度学习模型推理。
适用场景
- 模型预测
- 批量推理
- 实时服务
通用推理流程
1. 环境检查
# GPU 检查
python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"
# 模型文件检查
ls -la models/
# 依赖检查
pip list | grep -E "torch|onnx|tensorrt"
2. 模型加载
# PyTorch 示例
model = torch.load("models/model.pt")
model.eval()
# Hugging Face 示例
from transformers import AutoModel
model = AutoModel.from_pretrained("models/my-model")
3. 推理执行
# 单文件推理
python infer.py --input data/input.txt --output results/
# 批量推理
python infer.py --input-dir data/batch/ --output-dir results/
# API 服务模式
python serve.py --model models/model.pt --port 8000
性能优化
加速选项
| 方法 | 命令/配置 |
|---|---|
| 半精度推理 | --fp16 或 torch.float16 |
| 批量处理 | --batch-size 32 |
| ONNX 转换 | torch.onnx.export() |
| TensorRT | trtexec --onnx=model.onnx |
显存优化
# 梯度检查点
torch.cuda.empty_cache()
# 推理模式
with torch.no_grad():
output = model(input)
常用框架
| 框架 | 推理命令 |
|---|---|
| PyTorch | python infer.py |
| Hugging Face | python -m transformers.pipelines |
| ONNX Runtime | python onnx_infer.py |
| TensorRT | trtexec --loadEngine=model.trt |
输出格式
保存结果
# JSON 格式
import json
with open("results.json", "w") as f:
json.dump(results, f)
# CSV 格式
import pandas as pd
df.to_csv("results.csv", index=False)
注意事项
- 首次运行需要加载模型权重(可能较慢)
- 确保输入数据格式与训练时一致
- 检查 GPU 显存是否充足
- 大批量推理建议分批处理
项目定制
根据项目需要修改此文件,添加具体的:
- 模型路径和类型
- 输入/输出格式
- 推理参数
- 后处理逻辑
记住: 推断必须有来源——上下文、代码、文档。无依据的推断就是猜测,应标记 TBD。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 119 lines · 5 tokens per session scan A 00721c2a4028
infer is a command published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 5 tokens to every session and 688 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
audit-agents-skills
Audit quality of agents, skills, and commands in a Claude Code project.
audit-whitepapers
Audit version freshness, FR/EN parity, and metadata quality of all whitepapers and recap cards.
audit-repo-docs
Audit repository documentation against 85+ best practices from claude-code-ultimate-guide.
boldguy-linkedin-answer
Draft a LinkedIn comment on a post, referencing the guide's relevant section, in Flow style with AI markers removed.
methodology-advisor
Analyzes your codebase and asks 3 targeted questions to recommend the right AI-assisted development methodology stack.
security-audit
Comprehensive security audit of your project AND Claude Code configuration. Analyzes secrets exposure, injection surfaces, dependencies, hook security, and produces a scored security posture assessment.