How to Deploy a Model to the Edge

📘

Before deploying a model to your edge device the following dependencies must be met

  • ARM or x86 CPU
  • Linux or Unix operating system
  • Docker
  • Enough storage and memory to load and run your chosen models

If you've already created a device group and generated a device token you're ready to deploy a model to the edge.

You can either do this automatically using wget or with a manual download.

:fast-forward: Automatic device connection (via wget)

Go to your device group page and click on the Device Tokens tab on the left hand side of the page.

Next, select the Device type for the edge device to which you'll be deploying your model. It's important to choose an option that matches your device's chip set type (e.g. ARM vs. x86). Finally, click the Generate Commands button, which will display a set of three commands on your screen.

Device registration commands

Pre-generated commands used to automatically deploy models to an edge device

🚧

wget URLs are time-sensitive

The wget download URL expires after 10 minutes, so be quick!

The commands that appear can be copied, as you'll need to run them on your edge device to complete the connection.

Finish connection from your edge device

The last step is to run the commands you just generated on the edge device where you'd like to deploy your model(s). To do so, you'll need to:

  1. Log in to your edge device
  2. Open up a terminal
  3. Navigate to the folder where you'd like to install Modzy Core, the executable that provides an API interface for your models
  4. Paste the commands you just generated into your terminal window one by one, which should look similar to the example below
wget 'https://trial.app.modzy.com/api/downloads/modzy-core-linux-amd64?token=s.2E9a04ZyX1RNgDS0k9HvIx9g' -O modzy-core
chmod +x modzy-core
./modzy-core server --modzy.url https://trial.app.modzy.com --modzy.token DEVICE_REGISTRATION_TOKEN

In the example above make sure to replace DEVICE_REGISTRTION_TOKEN with a valid, unexpired device token (it will look something like s.mJdlDcCOxE7XyZSlUwTtDvCd)

After running these commands you should see a lot of messages appearing in your terminal providing status information about the installation and downloading process:

2023-04-06T19:14:24.492Z    INFO    logger/logger.go:108    acquiring lock
2023-04-06T19:14:24.493Z    INFO    logger/logger.go:108    connecting to Modzy...
2023-04-06T19:14:24.494Z    INFO    logger/logger.go:108    device token provided, proceeding with registration via http
2023-04-06T19:14:25.131Z    INFO    nats/server.go:31   starting internal NATS server...
2023-04-06T19:14:25.210Z    INFO    cmd/server.go:187   migrating database
2023-04-06T19:14:25.252Z    INFO    logger/logger.go:108    Configuring Core
2023-04-06T19:14:25.287Z    INFO    apiserver/server.go:73  Modzy Core server is starting...
2023-04-06T19:14:25.288Z  INFO  apiserver/server.go:232 Server is starting...
2023-04-06T19:14:25.289Z    INFO    apiserver/server.go:274 Server is listening at :55000
⠼ Reconciling Models
⠼   Pulling g0h96fgwjq.1.0.0 model image

After your model(s) are downloaded, you should see the following message, indicating that they are ready for execution:

✓   Model g0h96fgwjq.1.0.0 now live and running