

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

# 部署模型
<a name="neo-deployment-edge"></a>

您可以透過以下方式將運算模組部署到資源受限的 Edge 裝置：將已編譯模型從 Amazon S3 下載到您的裝置並使用 [DLR](https://github.com/neo-ai/neo-ai-dlr)，或者您可以使用 [AWS IoT Greengrass](https://docs.aws.amazon.com/greengrass/latest/developerguide/what-is-gg.html)。

在繼續下一個操作之前，請確定 SageMaker Neo 必須支援您的 Edge 裝置。請參閱[支援的架構、裝置、系統和架構](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-supported-devices-edge.html)，深入了解受支援的 Edge 裝置。在提交編譯任務時，請確定您已指定目標 Edge 裝置，請參閱[使用 Neo 編譯模型](https://docs.aws.amazon.com/sagemaker/latest/dg/neo-job-compilation.html)。

## 部署已編譯模型 (DLR)
<a name="neo-deployment-dlr"></a>

[DLR](https://github.com/neo-ai/neo-ai-dlr) 是適用於深度學習模型和決策樹模型的常見緊湊執行期。DLR 使用 [TVM](https://github.com/neo-ai/tvm) 執行期、[Treelite](https://treelite.readthedocs.io/en/latest/install.html) 執行期、NVIDIA TensorRT™，且可以包含其他特定硬體的執行期。DLR 提供統一的 Python/C\$1\$1 API，適用於在各種裝置上載入和執行已編譯的模型。

您可以使用以下 pip 命令安裝最新發行版本的 DLR 套件：

```
pip install dlr
```

如需在 GPU 目標或非 x86 Edge 裝置上安裝 DLR，請參閱預先建置二進位的[版本](https://github.com/neo-ai/neo-ai-dlr/releases)，或參閱[安裝適用於從來源建置 DLR 的 DLR](https://neo-ai-dlr.readthedocs.io/en/latest/install.html)。例如，若要安裝適用於 Raspberry Pi 3 的 DLR，您可以使用：

```
pip install https://neo-ai-dlr-release.s3-us-west-2.amazonaws.com/v1.3.0/pi-armv7l-raspbian4.14.71-glibc2_24-libstdcpp3_4/dlr-1.3.0-py3-none-any.whl
```

## 部署模型 (AWS IoT Greengrass)
<a name="neo-deployment-greengrass"></a>

[AWS IoT Greengrass](https://docs.aws.amazon.com/greengrass/latest/developerguide/what-is-gg.html) 將雲端功能擴展到本機裝置。它讓裝置收集與分析更接近資訊來源的資料、自主回應本機裝置，在本機網路上安全地互相通訊。透過 AWS IoT Greengrass，您可以使用雲端訓練模型，在本機產生的資料上執行邊緣機器學習推論。目前，您可以在基於 ARM Cortex-A、Intel Atom 和 Nvidia Jetson 系列處理器的所有 AWS IoT Greengrass 裝置上部署模型。如需部署 Lambda 推論應用程式以使用 AWS IoT Greengrass 執行機器學習推論的詳細資訊，請參閱[如何使用 AWS 管理主控台設定最佳化機器學習推論](https://docs.aws.amazon.com/greengrass/latest/developerguide/ml-dlc-console.html)。