

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 对 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.  查看常见的[框架特定的错误](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_cn/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. 前往亚马逊，网 CloudWatch 址为[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)。

1. 从右上角的**区域**下拉列表中选择您创建编译作业的区域。

1. 在 Amazon 的导航窗格中 CloudWatch，选择**日志**。选择**日志组**。

1. 搜索名为 `/aws/sagemaker/CompilationJobs` 的日志组。选择日志组。

1. 搜索以编译作业名称命名的日志流。选择日志流。