指标¶
对于指标,我们建议使用Tensorboard将指标直接记录到云存储中,与您的模型一起。在模型训练时,您可以在本地启动一个tensorboard实例来监控模型的进度:
$ tensorboard --log-dir provider://path/to/logs
或者你可以使用torchx.components.metrics.tensorboard()组件作为你管道的一部分。
查看训练师示例以获取如何使用PyTorch Lightning TensorboardLogger的示例。
参考¶
PyTorch Tensorboard 教程 https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html
PyTorch Lightning 日志记录器 https://pytorch-lightning.readthedocs.io/en/stable/extensions/logging.html
- torchx.components.metrics.tensorboard(logdir: str, image: str = 'ghcr.io/pytorch/torchx:0.7.0', timeout: float = 3600, port: int = 6006, start_on_file: str = '', exit_on_file: str = '') AppDef[source]¶
该组件运行一个Tensorboard服务器,它将渲染由logdir指定的日志。
由于Tensorboard作为服务运行,您需要指定终止条件。这包括一个超时时间以及一个可选的
exit_on_file,当创建该路径时,服务将退出。文件会通过fsspec定期轮询是否存在,并在创建时触发相应的行为。
- Parameters:
logdir – Tensorboard日志的fsspec路径
image – 要使用的图像
timeout – 退出前运行的最大时间(秒)
start_on_file – 当创建fsspec路径时启动服务器
exit_on_file – 当创建fsspec路径时关闭服务器