

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

# 故障診斷 Neo 編譯錯誤
<a name="neo-troubleshooting-compilation"></a>

本節包含如何了解並防止常見的編譯錯誤、其所產生錯誤訊息的資訊，以及如何解決這些錯誤的指導方針。

**Topics**
+ [如何使用此頁面](#neo-troubleshooting-compilation-how-to-use)
+ [架構相關錯誤](#neo-troubleshooting-compilation-framework-related-errors)
+ [基礎設施相關錯誤](#neo-troubleshooting-compilation-infrastructure-errors)
+ [檢查您的編譯日誌](#neo-troubleshooting-compilation-logs)

## 如何使用此頁面
<a name="neo-troubleshooting-compilation-how-to-use"></a>

請依照下列順序瀏覽這些區段，嘗試解決您的錯誤：

1. 檢查編譯任務的輸入是否符合輸入要求。請參閱[SageMaker Neo 應有哪些輸入資料形狀？](neo-compilation-preparing-model.md#neo-job-compilation-expected-inputs)

1.  檢查常見的 [framework-specific 錯誤](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-troubleshooting-compilation.html#neo-troubleshooting-compilation-framework-related-errors)。

1.  檢查您的錯誤是否為[基礎設施錯誤](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-troubleshooting-compilation.html#neo-troubleshooting-compilation-infrastructure-errors)。

1. 檢查您的[編譯日誌](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-troubleshooting-compilation.html#neo-troubleshooting-compilation-logs)。

## 架構相關錯誤
<a name="neo-troubleshooting-compilation-framework-related-errors"></a>

### Keras
<a name="neo-troubleshooting-compilation-framework-related-errors-keras"></a>


| 錯誤 | 解決方案 | 
| --- | --- | 
|   `InputConfiguration: No h5 file provided in <model path>`   |   檢查您的 h5 檔案是否位於您所指定的 Amazon S3 URI 中。 *或* 檢查 [h5 檔案格式是否正確](https://www.tensorflow.org/guide/keras/save_and_serialize#keras_h5_format)。  | 
|   `InputConfiguration: Multiple h5 files provided, <model path>, when only one is allowed`   |  檢查您是否只提供一個 `h5`檔案。  | 
|   `ClientError: InputConfiguration: Unable to load provided Keras model. Error: 'sample_weight_mode'`   |  檢查您指定的 Keras 版本是否受到支援。請參閱[雲端執行個體](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-supported-cloud.html)和[邊緣裝置](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-supported-devices-edge.html)支援的架構。  | 
|   `ClientError: InputConfiguration: Input input has wrong shape in Input Shape dictionary. Input shapes should be provided in NCHW format. `   |   檢查您的模型輸入是否遵循 NCHW 格式。參閱 [SageMaker Neo 應有哪些輸入資料形狀？](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-job-compilation.html#neo-job-compilation-expected-inputs)   | 

### MXNet
<a name="neo-troubleshooting-compilation-framework-related-errors-mxnet"></a>


| 錯誤 | 解決方案 | 
| --- | --- | 
|   `ClientError: InputConfiguration: Only one parameter file is allowed for MXNet model. Please make sure the framework you select is correct.`   |   SageMaker Neo 會選取第一個指定的參數檔案進行編譯。  | 

### TensorFlow
<a name="neo-troubleshooting-compilation-framework-related-errors-tensorflow"></a>


| 錯誤 | 解決方案 | 
| --- | --- | 
|   `InputConfiguration: Exactly one .pb file is allowed for TensorFlow models.`   |  請確定您只提供一個 .pb 或 .pbtxt 檔案。  | 
|  `InputConfiguration: Exactly one .pb or .pbtxt file is allowed for TensorFlow models.`  |  請確定您只提供一個 .pb 或 .pbtxt 檔案。  | 
|   ` ClientError: InputConfiguration: TVM cannot convert <model zoo> model. Please make sure the framework you selected is correct. The following operators are not implemented: {<operator name>} `   |   檢查您所選的運算子是否受到支援。參閱 [SageMaker Neo 支援的架構與運算子](https://aws.amazon.com/releasenotes/sagemaker-neo-supported-frameworks-and-operators/)。  | 

### PyTorch
<a name="neo-troubleshooting-compilation-framework-related-errors-pytorch"></a>


| 錯誤 | 解決方案 | 
| --- | --- | 
|   `InputConfiguration: We are unable to extract DataInputConfig from the model due to input_config_derivation_error. Please override by providing a DataInputConfig during compilation job creation.`  |  執行下列任何一項： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/sagemaker/latest/dg/neo-troubleshooting-compilation.html)  | 

## 基礎設施相關錯誤
<a name="neo-troubleshooting-compilation-infrastructure-errors"></a>


| 錯誤 | 解決方案 | 
| --- | --- | 
|   `ClientError: InputConfiguration: S3 object does not exist. Bucket: <bucket>, Key: <bucket key>`   |  檢查您提供的 Amazon S3 URI。  | 
|   ` ClientError: InputConfiguration: Bucket <bucket name> is in region <region name> which is different from AWS Sagemaker service region <service region> `   |   建立與服務位於同一區域的 Amazon S3 儲存貯體。  | 
|   ` ClientError: InputConfiguration: Unable to untar input model. Please confirm the model is a tar.gz file `   |   檢查您在 Amazon S3 中的模型是否已壓縮到 `tar.gz`檔案中。  | 

## 檢查您的編譯日誌
<a name="neo-troubleshooting-compilation-logs"></a>

1. 前往 [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 登入 Amazon CloudWatch。

1. 從右上角的 **Region** (區域) 下拉式清單中，選取您建立編譯任務的區域。

1. 在 Amazon CloudWatch 導覽窗格中，選擇 **Logs** (日誌)。選取 **Log groups** (日誌群組)。

1. 搜尋名為 `/aws/sagemaker/CompilationJobs`的日誌群組。選取日誌群組。

1. 搜尋以編譯任務名稱命名的日誌串流。選取日誌串流。