Google Professional Machine Learning Engineer Question 199
Select 3Google Cloud PlatformYou are training a machine learning model using TensorFlow, but your team uses PyTorch for other projects. You want to use TensorBoard to monitor training metrics for both TensorFlow and PyTorch models in a unified way. What steps should you take to configure TensorBoard correctly for this scenario?
- A
Use TensorFlow's built-in TensorBoard callback to log training metrics during TensorFlow model training.
- B
Install PyTorch's
torch.utils.tensorboardmodule and use it to log training metrics during PyTorch model training. - C
Use TensorFlow's
summary.FileWriterto log PyTorch training metrics. - D
Launch a single TensorBoard instance pointing to a shared log directory that contains logs from both TensorFlow and PyTorch.
- E
Manually convert PyTorch logs to TensorFlow format before using TensorBoard.
Show answer and explanation
Correct answers: A, B, D
Explanation
To monitor training metrics from both TensorFlow and PyTorch models, you can use TensorFlow's TensorBoard callback and PyTorch's torch.utils.tensorboard module to log metrics to the same directory. Then, a single TensorBoard instance can read and visualize the logs from both frameworks. This avoids the need for manual log conversion while ensuring compatibility.
- A. Correct.
Correct: TensorFlow provides a built-in TensorBoard callback to log training metrics directly during model training.
- B. Correct.
Correct: PyTorch offers the
torch.utils.tensorboardmodule for integrating with TensorBoard, which allows you to log metrics during training. - C. Incorrect.
Incorrect: The
summary.FileWriteris specific to TensorFlow and cannot be directly used to log PyTorch metrics. - D. Correct.
Correct: TensorBoard can read logs from a shared directory, enabling monitoring of metrics from both TensorFlow and PyTorch models.
- E. Incorrect.
Incorrect: Manually converting PyTorch logs is unnecessary because PyTorch already has built-in support for TensorBoard logging.