hugging-face-trackio
它能做什么
Trackio 是一个帮助记录和可视化 AI 模型训练进度的工具。它可以让你追踪重要指标,并在模型表现出现问题时收到提醒。
适用场景
- ✓当你在训练 AI 模型,并想实时查看训练进展时。
- ✓当训练过程中出现错误或效果很差等情况,希望自动收到预警时。
- ✓当你想分析过去训练的结果和指标时,即使训练已经结束也可以。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-trackio/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想记录模型训练的 loss 和 accuracy 指标,把所有内容保存到项目“my-project”中,并同步到 Space“my-user/my-space”。”
每周 5 个新技能,1 分钟读完。
工作原理
你需要把 Trackio 的代码加入训练脚本,用来记录指标和提醒。它会把这些信息发送到一个在线仪表盘,让你清晰地查看所有内容。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Trackio - Experiment Tracking for ML Training
Trackio is an experiment tracking library for logging and visualizing ML training metrics. It syncs to Hugging Face Spaces for real-time monitoring dashboards.
Three Interfaces
| Task | Interface | Reference |
|---|---|---|
| Logging metrics during training | Python API | references/logging_metrics.md |
| Firing alerts for training diagnostics | Python API | references/alerts.md |
| Retrieving metrics & alerts after/during training | CLI | references/retrieving_metrics.md |
When to Use Each
Python API → Logging
Use import trackio in your training scripts to log metrics:
- Initialize tracking with
trackio.init() - Log metrics with
trackio.log()or use TRL'sreport_to="trackio" - Finalize with
trackio.finish()
Key concept: For remote/cloud training, pass space_id — metrics sync to a Space dashboard so they persist after the instance terminates.
→ See references/logging_metrics.md for setup, TRL integration, and configuration options.
Python API → Alerts
Insert trackio.alert() calls in training code to flag important events — like inserting print statements for debugging, but structured and queryable:
trackio.alert(title="...", level=trackio.AlertLevel.WARN)— fire an alert- Three severity levels:
INFO,WARN,ERROR - Alerts are printed to terminal, stored in the database, shown in the dashboard, and optionally sent to webhooks (Slack/Discord)
Key concept for LLM agents: Alerts are the primary mechanism for autonomous experiment iteration. An agent should insert alerts into training code for diagnostic conditions (loss spikes, NaN gradients, low accuracy, training stalls). Since alerts are printed to the terminal, an agent that is watching the training script's output will see them automatically. For background or detached runs, the agent can poll via CLI instead.
→ See references/alerts.md for the full alerts API, webhook setup, and autonomous agent workflows.
CLI → Retrieving
Use the trackio command to query logged metrics and alerts:
trackio list projects/runs/metrics— discover what's availabletrackio get project/run/metric— retrieve summaries and valuestrackio list alerts --project <name> --json— retrieve alertstrackio show— launch the dashboardtrackio sync— sync to HF Space
Key concept: Add --json for programmatic output suitable for automation and LLM agents.
→ See references/retrieving_metrics.md for all commands, workflows, and JSON output formats.
Minimal Logging Setup
import trackio
trackio.init(project="my-project", space_id="username/trackio")
trackio.log({"loss": 0.1, "accuracy": 0.9})
trackio.log({"loss": 0.09, "accuracy": 0.91})
trackio.finish()
Minimal Retrieval
trackio list projects --json
trackio get metric --project my-project --run my-run --metric loss --json
Autonomous ML Experiment Workflow
When running experiments autonomously as an LLM agent, the recommended workflow is:
- Set up training with alerts — insert
trackio.alert()calls for diagnostic conditions - Launch training — run the script in the background
- Poll for alerts — use
trackio list alerts --project <name> --json --since <timestamp>to check for new alerts - Read metrics — use
trackio get metric ...to inspect specific values - Iterate — based on alerts and metrics, stop the run, adjust hyperparameters, and launch a new run
import trackio
trackio.init(project="my-project", config={"lr": 1e-4})
for step in range(num_steps):
loss = train_step()
trackio.log({"loss": loss, "step": step})
if step > 100 and loss > 5.0:
trackio.alert(
title="Loss divergence",
text=f"Loss {loss:.4f} still high after {step} steps",
level=trackio.AlertLevel.ERROR,
)
if step > 0 and abs(loss) < 1e-8:
trackio.alert(
title="Vanishing loss",
text="Loss near zero — possible gradient collapse",
level=trackio.AlertLevel.WARN,
)
trackio.finish()
Then poll from a separate terminal/process:
trackio list alerts --project my-project --json --since "2025-01-01T00:00:00"
Limitations
…
常见问题
什么是“指标”?
指标是用来衡量 AI 模型学习效果的数字,比如 “loss”(损失,表示模型错得有多离谱)或 “accuracy”(准确率,表示模型答得有多准确)。
什么是“提醒”?
提醒是你预先设置的警告,当训练过程中出现某些特定情况时就会触发,比如严重错误或意外问题。
我怎么查看结果?
你可以在在线仪表盘(Hugging Face Spaces)上查看结果,也可以使用终端命令获取已记录的信息。
详情
作者的原始描述
Track and visualize ML training experiments with Trackio. Use when logging metrics during training (Python API), firing alerts for training diagnostics, or retrieving/analyzing logged metrics (CLI).
热度
- GitHub 星标
- 48k
- 排名
- #4843
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。