

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 內建演算法的日誌
<a name="common-info-all-sagemaker-models-logs"></a>

Amazon SageMaker AI 演算法會產生 Amazon CloudWatch Logs，其中提供訓練流程的詳細資訊。若要查看日誌，請在 AWS 管理主控台中選擇 **CloudWatch**、選擇**日誌**，然後選擇 /aws/sagemaker/TrainingJobs **日誌群組**。每一項訓練工作進行訓練的各節點都有一個日誌串流。日誌串流的名稱會以建立工作時 `TrainingJobName` 參數所指定的值為開頭。

**注意**  
若工作失敗，而日誌未出現在 CloudWatch 內，可能再訓練開始前就已發生錯誤。原因包括訓練影像指定錯誤，或 S3 位置指定錯誤。

日誌的內會因演算法而異。不過一般可以看到下列資訊：
+ 日誌開頭對所提供的引數的確認
+ 訓練時發生的錯誤
+ 演算法準確度或數值效能的測量資料
+ 演算法的時間以及演算法的任何重要階段

## 常見錯誤
<a name="example-errors"></a>

若訓練工作失敗，`FailureReason` 所提供的錯誤詳細資訊會在訓練工作描述中將值傳回，如下所示：

```
sage = boto3.client('sagemaker')
sage.describe_training_job(TrainingJobName=job_name)['FailureReason']
```

其他僅會在 CloudWatch 日誌中回報。常見錯誤包括下列項目：

1. 超參數指定錯誤，或指定的超參數對該演算法無效。

   **來自 CloudWatch 日誌**

   ```
   [10/16/2017 23:45:17 ERROR 139623806805824 train.py:48]
   Additional properties are not allowed (u'mini_batch_siz' was
   unexpected)
   ```

1. 超參數指定的值無效。

   **FailureReason**

   ```
   AlgorithmError: u'abc' is not valid under any of the given
   schemas\n\nFailed validating u'oneOf' in
   schema[u'properties'][u'feature_dim']:\n    {u'oneOf':
   [{u'pattern': u'^([1-9][0-9]*)$', u'type': u'string'},\n
   {u'minimum': 1, u'type': u'integer'}]}\
   ```

   **FailureReason**

   ```
   [10/16/2017 23:57:17 ERROR 140373086025536 train.py:48] u'abc'
   is not valid under any of the given schemas
   ```

1. protobuf 檔案格式不正確。

   **來自 CloudWatch 日誌**

   ```
   [10/17/2017 18:01:04 ERROR 140234860816192 train.py:48] cannot
                      copy sequence with size 785 to array axis with dimension 784
   ```