Deploy ML models across your fleet
Deploy a trained ML model to one machine or your entire fleet using the same fragment workflow you use for modules. When you retrain and upload a new model version, machines configured to track that version update automatically.
When to use this
Use this page when you have a trained model in the Viam registry and want to deploy it to multiple machines. If you are deploying to a single machine for the first time, start with deploy a model to a machine.
Prerequisites
- A trained ML model in the Viam registry. See train a model.
- At least one machine with a camera configured. See add a camera.
- A fragment for your fleet. If you don’t have one yet, create one first.
How model deployment works
ML models are deployed as registry packages, the same way modules are. A machine needs two services to run a model:
- ML model service: loads the model file and runs inference.
- Vision service: connects the ML model service to a camera and returns detections or classifications.
You configure both services in a fragment, apply the fragment to your machines, and every machine downloads the model and starts running inference.
1. Add the model and vision service to a fragment
- Navigate to your fragment at app.viam.com/fragments.
- Click + and add an ML model service (for example, search for
tfliteand add tflite_cpu). - In the ML model service card, under Deployment, select Deploy model on machine.
- Click Select model and choose your trained model from the registry.
- Click + again and add a vision service. Search for
mlmodeland add the mlmodel vision service. - Configure the vision service to use the ML model service you just added.
- Click Save.
2. Choose a version strategy
Each ML model package has a version field in the fragment configuration.
- Track latest: leave the version at the default. When you upload a retrained model, machines update automatically on their next config sync.
- Pin to a specific version: set the version string to prevent automatic updates until you are ready.
- Use fragment tags: create
stableanddevelopmenttags on the fragment. Test new models on development machines before promoting to production. See reuse configuration for the tag workflow.
To control the timing of updates, configure a maintenance window so models are not swapped while a machine is actively processing. See manage versions.
3. Apply the fragment to machines
Apply the fragment to your machines through the Viam app, provisioning, or CLI. See deploy software for the steps.
4. Verify the deployment
- Navigate to a machine’s CONTROL tab.
- Find the vision service card and test it with a live camera feed to confirm detections or classifications appear.
- Check the LOGS tab for errors from the ML model service or vision service.
Update a model across the fleet
When you retrain and upload a new model version:
- Tracking latest: machines update on their next config sync (or within the maintenance window).
- Using fragment tags: update the fragment configuration with the new model version, save to create a new revision, then move the
stabletag to the new revision. - Pinned to a version: update the version string in the fragment and save.
Related pages
- Train a model for creating ML models
- Deploy a model to a machine for single-machine deployment
- Configure computer vision for vision pipeline details
- Reuse configuration for fragment management
- Manage versions for version pinning and maintenance windows
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!