ASSIGNMENT 01 / 5.3
组合训练循环
5.3 训练循环#
现在终于可以把全部组件放进主训练脚本。
让不同超参数的训练任务容易启动会很有价值,例如通过命令行参数控制,因为后续会反复比较不同选择对训练的影响。
练习 training_together4 分
把组件组合起来
交付物: 编写训练脚本,对用户提供的输入运行训练循环。建议至少支持:
- 配置和控制模型、优化器的各种超参数。
- 使用
np.memmap 以内存高效的方式加载大型训练集、验证集。
- 将检查点保存到用户指定路径。
- 定期记录训练与验证表现,可输出到控制台,或发送到 Weights & Biases 等外部服务。
一起把这一章读得更好
发现翻译、公式或排版错误?欢迎反馈。概念疑问和学习心得,也可以在本章讨论中交流。
直接选中正文,点击旁边的「反馈这处错误」,即可在页内填写并提交,无需登录。English original 展开本章英文原文 PDF 文本提取
下列文本提取自本地原版 PDF。图表和公式的准确布局请对照 PDF。
5.3 Training loop
Now, it’s finally time to put all of the components you implemented together into your main training
script. It will pay off to make it easy to start training runs with different hyperparameters (e.g., by taking
them as command-line arguments), since you will be doing these many times later to study how different
choices impact training.
Problem (training_together): Put it together (4 points)
Deliverable: Write a script that runs a training loop to train your model on user-provided input.
In particular, we recommend that your training script allow for (at least) the following:
• Ability to configure and control the various model and optimizer hyperparameters.
• Memory-efficient loading of large training and validation datasets with np.memmap.
• Serializing checkpoints to a user-provided path.
• Periodically logging training and validation performance (e.g., to console and/or an external
service like Weights and Biases).9
本章讨论
在 GitHub 查看记录 ↗