This repository demonstrates the use of AWS IoT GreengrassV2 for running Generative AI models on Edge devices specifically NVIDIA Jetson Devices. The work here focuses on running large models on edge devices for a cheaper, faster, and efficient solution. The repository using AWS IoT GreengrassV2 on the edge device to communicate between AWS services and device. Here, the models once hosted on the edge device which is conncted to a camera, can accept text prompts to capture images and respond based on queries asked and chosen model. The query to the device and the response back to cloud is being done using MQTT protocol.
Currently the sample supports 2 types of GenAI models:
Note: This is specifically for NVIDIA Jetson like edge devices and have been tested on NVIDIA Jetson Orin 8/16/32 GB and Jetson Orin Nano.
Requirements:
Models used:
Prerequisites:
The above image shows the overall connection of Jetson device and AWS services for running different GenAI models on edge. Details of the services used and their integration with the edge device is shown below.
Follow these steps after edge device is provisioned for AWS IoT GreengrassV2:
$ export AWS_ACCOUNT_NUM="ADD_ACCOUNT_NUMBER"
$ export AWS_REGION="ADD_ACCOUNT_REGION"
$ export AWS_REGION="ADD_REGION"
$ export DEV_IOT_THING="NAME_OF_OF_THING"
$ export DEV_IOT_THING_GROUP="NAME_OF_IOT_THING_GROUP"
com.aws.jetson.docker component using socket communication.com.aws.jetson.docker component runs the docker container and communicates using socket with the com.aws.edge.genai component.com.aws.edge.genai is responsbile to connect with camera and communicate between cloud and docker using MQTT and socket respectively for running inference and sending results to AWS IoT Core.{
"event": "capture",
"type": "nanovlm" / "fastersam"
}
{
"event": "text",
"text": "Describe the scene" / "Segment trees and roads",
"type": "nanovlm" / "fastersam"
}
{
"event": "reset",
"type": "nanovlm" / "fastersam"
}
[On Edge Device]
$ git clone https://github.com/aws-samples/genai-at-edge
$ cd genai-at-edge/greengrass
$ chmod u+x provisioning.sh
$ ./provisioning.sh
$ [Check Jetpack version of Jetson device] sudo apt-cache show nvidia-jetpack
provisioning.sh script only works for Ubuntu based system.IoT Thing & IoT Thing Group and if not entered, would take default values.IoT Thing and its IoT Thing Group would be available on the AWS Console.```
$ export ALGO_NAME="genai-at-edge"
$ [For JetPack 5] docker pull dustynv/nano_llm:r35.4.1 && docker build -t ${ALGO_NAME} -f docker/Dockerfile.r35.4.1 .
$ [For JetPack 6] docker pull dustynv/nano_llm:r36.2.0 && docker build -t ${ALGO_NAME} -f docker/Dockerfile.r36.2.0 .
$ aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com
$ (Once to create ECR Repository) aws ecr create-repository --repository-name ${ALGO_NAME}
$ docker tag ${ALGO_NAME} ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ALGO_NAME}:latest"
$ docker push ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ALGO_NAME}:latest"
```
```
$ python3 -m pip install -U git+https://github.com/aws-greengrass/aws-greengrass-gdk-cli.git@v1.2.0
[Install jq for Linux]
$ apt-get install jq
[Install jq for Linux]
$ brew install jq
$ cd greengrass/
$ chmod u+x deploy-gdk-build.sh
$ ./deploy-gdk-build.sh
[Upon request for options to build components, choose accordingly]
Select update option:
1. Update Component 1: EdgeGenAI
2. Update Component 2: Jetson Docker
3. Update All components (EdgeGenAI & Jetson Docker)
Enter your choice (1/2/3):
```
```
[Run the code as follows to cleanup]
$ cd greengrass/
$ python3 cleanup_gg.py
```
This project is loosely based on Jetson Tutorials for GenAI like:
MIT-0
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
4 commits
1 commits
Python
90.7%
HTML
6.0%
Shell
3.1%
This repository demonstrates the use of AWS IoT GreengrassV2 for running Generative AI models on Edge devices specifically NVIDIA Jetson Devices. The work here focuses on running large models on edge devices for a cheaper, faster, and efficient solution. The repository using AWS IoT GreengrassV2 on the edge device to communicate between AWS services and device. Here, the models once hosted on the edge device which is conncted to a camera, can accept text prompts to capture images and respond based on queries asked and chosen model. The query to the device and the response back to cloud is being done using MQTT protocol.
Currently the sample supports 2 types of GenAI models:
Note: This is specifically for NVIDIA Jetson like edge devices and have been tested on NVIDIA Jetson Orin 8/16/32 GB and Jetson Orin Nano.
Requirements:
Models used:
Prerequisites:
The above image shows the overall connection of Jetson device and AWS services for running different GenAI models on edge. Details of the services used and their integration with the edge device is shown below.
Follow these steps after edge device is provisioned for AWS IoT GreengrassV2:
$ export AWS_ACCOUNT_NUM="ADD_ACCOUNT_NUMBER"
$ export AWS_REGION="ADD_ACCOUNT_REGION"
$ export AWS_REGION="ADD_REGION"
$ export DEV_IOT_THING="NAME_OF_OF_THING"
$ export DEV_IOT_THING_GROUP="NAME_OF_IOT_THING_GROUP"
com.aws.jetson.docker component using socket communication.com.aws.jetson.docker component runs the docker container and communicates using socket with the com.aws.edge.genai component.com.aws.edge.genai is responsbile to connect with camera and communicate between cloud and docker using MQTT and socket respectively for running inference and sending results to AWS IoT Core.{
"event": "capture",
"type": "nanovlm" / "fastersam"
}
{
"event": "text",
"text": "Describe the scene" / "Segment trees and roads",
"type": "nanovlm" / "fastersam"
}
{
"event": "reset",
"type": "nanovlm" / "fastersam"
}
[On Edge Device]
$ git clone https://github.com/aws-samples/genai-at-edge
$ cd genai-at-edge/greengrass
$ chmod u+x provisioning.sh
$ ./provisioning.sh
$ [Check Jetpack version of Jetson device] sudo apt-cache show nvidia-jetpack
provisioning.sh script only works for Ubuntu based system.IoT Thing & IoT Thing Group and if not entered, would take default values.IoT Thing and its IoT Thing Group would be available on the AWS Console.```
$ export ALGO_NAME="genai-at-edge"
$ [For JetPack 5] docker pull dustynv/nano_llm:r35.4.1 && docker build -t ${ALGO_NAME} -f docker/Dockerfile.r35.4.1 .
$ [For JetPack 6] docker pull dustynv/nano_llm:r36.2.0 && docker build -t ${ALGO_NAME} -f docker/Dockerfile.r36.2.0 .
$ aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com
$ (Once to create ECR Repository) aws ecr create-repository --repository-name ${ALGO_NAME}
$ docker tag ${ALGO_NAME} ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ALGO_NAME}:latest"
$ docker push ${AWS_ACCOUNT_NUM}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ALGO_NAME}:latest"
```
```
$ python3 -m pip install -U git+https://github.com/aws-greengrass/aws-greengrass-gdk-cli.git@v1.2.0
[Install jq for Linux]
$ apt-get install jq
[Install jq for Linux]
$ brew install jq
$ cd greengrass/
$ chmod u+x deploy-gdk-build.sh
$ ./deploy-gdk-build.sh
[Upon request for options to build components, choose accordingly]
Select update option:
1. Update Component 1: EdgeGenAI
2. Update Component 2: Jetson Docker
3. Update All components (EdgeGenAI & Jetson Docker)
Enter your choice (1/2/3):
```
```
[Run the code as follows to cleanup]
$ cd greengrass/
$ python3 cleanup_gg.py
```
This project is loosely based on Jetson Tutorials for GenAI like:
MIT-0
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
4 commits
1 commits
Python
90.7%
HTML
6.0%
Shell
3.1%