Upload a Model to the Registry
The ML model service works with models trained inside and outside the Viam app. To use a model that you have trained yourself outside the Viam app, upload it as a new model privately or share it in the Viam registry. If you need to update a previously uploaded model, you can also upload a new version.
If you have trained or uploaded an ML model privately and now want to make it available for reuse, you can at any point make the existing model public in the registry.
Also, share a model from your organization with other users in the registry.
Model framework support
Before uploading your model to the cloud, check and see if you will be able to deploy it to your machine. Model framework support is currently as follows:
Model Framework | ML Model Service | Hardware Support | System Architecture | Description |
---|---|---|---|---|
TensorFlow Lite | tflite_cpu | Any CPU Nvidia GPU | Linux, Raspbian, MacOS, Android | Quantized version of TensorFlow that has reduced compatibility for models but supports more hardware. Uploaded models must adhere to the model requirements. |
ONNX | onnx_cpu | Any CPU Nvidia GPU | Android, MacOS, Linux arm-64 | Universal format that is not optimized for hardware inference but runs on a wide variety of machines. |
TensorFlow | triton | Nvidia GPU | Linux (Jetson) | A full framework that is made for more production-ready systems. |
PyTorch | triton | Nvidia GPU | Linux (Jetson) | A full framework that was built primarily for research. Because of this, it is much faster to do iterative development with (model doesn’t have to be predefined) but it is not as “production ready” as TensorFlow. It is the most common framework for OSS models because it is the go-to framework for ML researchers. |
Upload a new model or new version
On the DATA tab in the Viam app, navigate to the MODELS subtab. Click Upload model.
Select if you want to upload a New model or a New version of a previously published model.
Select Public to upload the model publicly to the Viam registry. This makes the model usable by any external organization. See ML models in the registry for more information.
Select Private to only publish the model for internal use within this organization. Select Next steps to continue.
- Select the Model framework or the type of model. TensorFlow Lite, TensorFlow, PyTorch, and ONNX model frameworks are currently supported.
- Upload the files required for your model framework:
- For a TensorFlow Lite or ONNX model framework, upload a
.txt
label file containing the label names you provided in training, with one name per line. - For a TensorFlow model framework, upload the model in the SavedModel format.
- For a TensorFlow Lite or ONNX model framework, upload a
- Specify a name for the model.
- Specify the Task type.
- Add a short description. This will help other users to understand how to use your model.
Select Upload model. The model is now visible on the MODELS subtab of the DATA tab in the Viam app and available to deploy on your machine. Also, if you selected Public, it should be publicly visible in the Viam registry.
- Select the model you would like to update from your existing models.
- Click Next steps to continue.
- Select the Model framework or the type of model. TensorFlow Lite, TensorFlow, PyTorch, and ONNX model frameworks are currently supported.
- Upload the files required for your model framework:
- For a TensorFlow Lite or ONNX model framework, upload a
.txt
label file containing the label names you provided in training, with one name per line. - For a TensorFlow model framework, upload the model in the SavedModel format.
- For a TensorFlow Lite or ONNX model framework, upload a
- Click Upload model.
Your model is now updated.
Note
If you deploy a model to a machine, Viam automatically assumes that this is the latest
version of the model and that you would always like to deploy the latest
version of the model to the machine.
If you upload a new version of that model, Viam will automatically deploy the new version to the machine and replace the old version.
If you do not want Viam to automatically deploy the latest
version of the model, you can change the packages
configuration in the JSON machine configuration.
You can get the version number from a specific model version by navigating to the models page, finding the model’s row, clicking on the right-side menu marked with … and selecting Copy package JSON. For example: 2024-02-28T13-36-51
.
The model package config looks like this:
{
"package": "<model_id>/<model_name>",
"version": "YYYY-MM-DDThh-mm-ss",
"name": "<model_name>",
"type": "ml_model"
}
Make an existing model public in the registry
To add a model that you’ve trained to the Viam registry so that other users can deploy it onto their robots:
- On the DATA tab in the Viam app, navigate to the MODELS subtab. You’ll see a list of all ML models you have access to.
- Open the menu on the right side of an ML model’s row.
- Then, click Make public in Registry.
- Add a short description. This will help other users to understand how to use your model.
- Then, click Publish model. Your model is now publicly visible in the Viam registry.
Next steps
Have questions, or want to meet other people working on robots? Join our Community Discord.
If you notice any issues with the documentation, feel free to file an issue or edit this file.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!