使用 Weights & Biases 跟踪实验
记录指标、配置与产物
使用 Weights & Biases 跟踪实验 是 CoddyKit 上的免费 Deep Learning Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Deep Learning Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Deep Learning Academy 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
Why Track Experiments at All
You will run a model dozens of times with tiny tweaks. Without records you forget what worked. Experiment tracking logs every run so progress is never lost. 📊
Meet Weights & Biases
Weights and Biases, often written wandb, is a popular tool that records metrics, settings, and outputs from each training run in one dashboard.
pip install wandbStart a Run
One call opens a new tracked session. wandb.init names your project so every run lands in the same place for easy comparison.
import wandb
wandb.init(project="mnist-cnn")Log Your Config
Save the settings that shaped a run, like learning rate and batch size. Storing this config lets you tie any result back to its exact recipe.
wandb.config.update({"lr": 0.001, "batch_size": 32})Log Metrics Each Step
Inside your loop, send numbers you care about. wandb.log records loss and accuracy so they plot as live curves over time.
wandb.log({"loss": loss.item(), "acc": acc})Live Dashboards
Every logged number streams to a web dashboard. You watch training curves update in real time and spot a diverging run before it wastes hours.
Compare Runs Side by Side
The real power is comparison. Overlay many runs and the dashboard shows which hyperparameters actually moved your accuracy upward.
Save Artifacts
Beyond numbers you can store files. Logging a trained checkpoint as an artifact keeps the exact weights paired with the run that made them.
wandb.save("model.pt")Finish Cleanly
When training ends, close the session so all data flushes to the server. Calling wandb.finish marks the run complete and ready to review.
wandb.finish()Sweeps Search for You
Tired of tuning by hand? A wandb sweep launches many runs across a range of settings and reports which combination wins automatically.
Tracking Is a Team Habit
Logged runs become shared history. Teammates open the same dashboard and instantly see your results, making your work reproducible and easy to trust.
Quick Check
Which call records metrics like loss during training?
Recap
You learned to track runs with wandb: init a project, log config and metrics, save artifacts, and finish. Now every experiment is recorded. 🎉
常见问题解答
「使用 Weights & Biases 跟踪实验」课时是免费的吗?
是的 — 「使用 Weights & Biases 跟踪实验」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Deep Learning Academy 课程的其余内容,请升级到 CoddyKit PRO。 Deep Learning Academy 课程共包含 4 节课。
「使用 Weights & Biases 跟踪实验」这节课中我会学到什么?
记录指标、配置与产物 你通过在浏览器中直接运行的动手代码来练习 Deep Learning Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 Deep Learning Academy 需要有经验吗?
无需任何先前经验。CoddyKit 上的 Deep Learning Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。
「使用 Weights & Biases 跟踪实验」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 Deep Learning Academy 课中编写并运行代码吗?
能。每节 Deep Learning Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。