Skip to content

Commit

Permalink
Move training scripts and ml models
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Oct 21, 2024
1 parent d614812 commit b8b0647
Show file tree
Hide file tree
Showing 46 changed files with 290 additions and 349 deletions.
2 changes: 1 addition & 1 deletion docs/appendix/apis/services/ml.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ images: ["/services/icons/ml.svg"]

The ML model service API allows you to make inferences based on a provided ML model.

The [ML Model service](/services/ml/deploy/) supports the following methods:
The [ML Model service](/services/ml/) supports the following methods:

{{< readfile "/static/include/services/apis/generated/mlmodel-table.md" >}}

Expand Down
8 changes: 4 additions & 4 deletions docs/appendix/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ In addition to other improvements, your component, service, and other resource c
{{% changelog date="2024-03-01" color="added" title="Additional ML models" %}}

Viam has added support for the TensorFlow, PyTorch, and ONNX ML model frameworks, expanding upon the existing support for TensorFlow Lite models.
You can now upload your own ML model(/services/ml/ml-models/) using any of these frameworks for use with the Vision service.
You can now upload your own ML model(/registry/ml-models/) using any of these frameworks for use with the Vision service.

{{% /changelog %}}

Expand Down Expand Up @@ -229,7 +229,7 @@ You can now use the [generic service](/services/generic/) to define new, unique

{{% changelog date="2024-02-12" color="added" title="ML models in the registry" %}}

You can now upload [machine learning (ML) models](/services/ml/ml-models/) to the Viam registry, in addition to modules.
You can now upload [machine learning (ML) models](/registry/ml-models/) to the Viam registry, in addition to modules.
You may upload models you have trained yourself using the Viam app, or models you have trained outside of the App.
When uploading, you have the option to make your model available to the general public for reuse.

Expand Down Expand Up @@ -922,8 +922,8 @@ You will need to first register the machine learning model file with the [ML mod

{{% changelog date="2023-03-31" color="added" title="Machine learning for image classification models" %}}

You can now [train](/how-tos/train-deploy-ml/) and [deploy](/services/ml/deploy/) image classification models with the [data management service](/services/data/) and use your machine's image data directly within Viam.
Additionally, you can upload and use existing [machine learning models](/services/ml/ml-models/) with your machines.
You can now [train](/how-tos/train-deploy-ml/) and [deploy](/services/ml/) image classification models with the [data management service](/services/data/) and use your machine's image data directly within Viam.
Additionally, you can upload and use existing [machine learning models](/registry/ml-models/) with your machines.
For more information on using data synced to the cloud to train machine learning models, read [Train a model](/how-tos/train-deploy-ml/).

{{% /changelog %}}
Expand Down
2 changes: 1 addition & 1 deletion docs/appendix/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The docs use the [Diátaxis Framework](https://diataxis.fr/) as the basis of t

- **How-to Guide (procedural)**: A task-oriented piece of content that directs a reader to perform actions step by step to complete a task, like instructions to sauté onions.
Generally starts with a description of the task and things to consider, and then provides a set of numbered steps to follow.
For example, the [Installation page](/installation/viam-server-setup/) or the [Find module page](/registry/configure/).
For example, the [Installation page](/installation/viam-server-setup/) or the [Find module page](/registry/modular-resources/).

{{< expand "Click to view template" >}}

Expand Down
2 changes: 1 addition & 1 deletion docs/appendix/glossary/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Models allow you to control hardware or software of a similar category, such as
For example, some _models_ of DC motors communicate using [GPIO](/components/board/), while other DC motors use serial protocols like the SPI bus.
Regardless, you can power any motor model that implements the `rdk:component:motor` API with the `SetPower()` method.

Models are either included with [`viam-server`](/architecture/rdk/), provided in {{< glossary_tooltip term_id="module" text="custom modules" >}} available for download from the [Viam registry](https://app.viam.com/registry), or installed as [local modules](/registry/configure/#local-modules).
Models are either included with [`viam-server`](/architecture/rdk/) or provided through {{< glossary_tooltip term_id="module" text="modules" >}}.
All models are uniquely namespaced as colon-delimited-triplets.
Built-in model names have the form `rdk:builtin:name`.
Modular resource model names have the form `namespace:repo-name:name`.
Expand Down
7 changes: 3 additions & 4 deletions docs/appendix/glossary/modular-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
title: Modular Resource
id: modular-resource
full_link: /registry/
short_description: A modular resource is a custom model of a component or service that implements the standardized API methods for that resource.
short_description: A modular resource is a model of a component or service provided by a module.
---

A modular resource is a custom {{< glossary_tooltip term_id="model" text="model" >}} of a {{< glossary_tooltip term_id="component" text="component" >}} or {{< glossary_tooltip term_id="service" text="service" >}} that implements the standardized [API methods](/appendix/apis/) for that {{< glossary_tooltip term_id="resource" text="resource" >}}.
Modular resources are provided by {{< glossary_tooltip term_id="module" text="modules" >}}, and are not built into `viam-server`.
A modular resource runs in the module process.
A modular resource is a {{< glossary_tooltip term_id="model" text="model" >}} of a {{< glossary_tooltip term_id="component" text="component" >}} or {{< glossary_tooltip term_id="service" text="service" >}} provided by a {{< glossary_tooltip term_id="module" text="module" >}}.
A modular resource runs in a module process.
This differs from built-in resources, which run as part of `viam-server`.

For more information see the [Modular Resource Documentation](/registry/).
2 changes: 1 addition & 1 deletion docs/appendix/glossary/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ short_description: A module provides one or more modular resources, which add re
A _module_ provides one or more {{< glossary_tooltip term_id="modular-resource" text="modular resources" >}}, which add {{< glossary_tooltip term_id="resource" text="resource" >}} {{< glossary_tooltip term_id="type" text="types" >}} or {{< glossary_tooltip term_id="model" text="models" >}} that are not built into Viam.
Modules run alongside `viam-server` as separate process, communicating with `viam-server` over UNIX sockets.

You can [create your own module](/how-tos/create-module/) or [add existing modules from the Viam registry](/registry/configure/).
You can [create your own module](/how-tos/create-module/) or [add existing modules from the Viam registry](/registry/modular-resources/).

For more information see the [modular resource documentation](/registry/).
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ The `--stream` argument, when included in the CLI command prior to the `--data`
### `training-script`
Manage training scripts for [custom ML training](/services/ml/training-scripts/).
Manage training scripts for [custom ML training](/registry/training-scripts/).
```sh {class="command-line" data-prompt="$"}
viam training-script upload --framework=<framework> --org-id=<org-id> --path=<path-to-script> --script-name=<script-name> --type=<type>
Expand Down
4 changes: 3 additions & 1 deletion docs/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ Find more information in the [processes documentation](/configure/processes/).
Modules allow you to add [modular resources](/registry/) to your machines which add resource types or models that are not built into Viam.
Many models are available in the [registry](https://app.viam.com/registry) and you are able to add them as components or services.

#### Local Modules

To add a module that is not in the registry and is local to your machine, click the **+** icon next to your {{< glossary_tooltip term_id="part" text="machine part" >}} in the left-hand menu of the **CONFIGURE** tab and select **Local module**.
Follow the instructions in our [registry documentation](/registry/configure/#add-a-local-module) to configure the module.
Follow the instructions in our [registry documentation](/registry/modular-resources/#configuration) to configure the module.

### Remote parts

Expand Down
2 changes: 1 addition & 1 deletion docs/fleet/fragments.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ This example uses [`$set`](https://www.mongodb.com/docs/manual/reference/operato

{{< /expand >}}
{{< expand "Pin a module version" >}}
This example uses [`$set`](https://www.mongodb.com/docs/manual/reference/operator/update/set/#mongodb-update-up.-set) to set [version update settings for a module](/registry/configure/#edit-the-configuration-of-a-module-from-the-viam-registry) named `custom-sensor` in the fragment:
This example uses [`$set`](https://www.mongodb.com/docs/manual/reference/operator/update/set/#mongodb-update-up.-set) to set [version update settings for a module](/registry/modular-resources/#configuration) named `custom-sensor` in the fragment:

```json {class="line-numbers linkable-line-numbers"}
"fragment_mods": [
Expand Down
14 changes: 7 additions & 7 deletions docs/how-tos/create-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cost: "0"
<br>

Viam provides built-in support for a variety of different {{< glossary_tooltip term_id="component" text="components" >}} and {{< glossary_tooltip term_id="service" text="services" >}}, as well as a registry full of {{< glossary_tooltip term_id="module" text="modules" >}} created by other users.
If no [existing modules](/registry/#modular-resources) support your specific use case, you can write your own [custom {{< glossary_tooltip term_id="resource" text="resources" >}}](/registry/) by creating a module, and either upload it to the [Viam registry](https://app.viam.com/registry) to share it publicly, or deploy it to your machine as a local module without uploading it to the registry.
If no [existing modules](/registry/modular-resources/) support your specific use case, you can write your own [custom {{< glossary_tooltip term_id="resource" text="resources" >}}](/registry/) by creating a module, and either upload it to the [Viam registry](https://app.viam.com/registry) to share it publicly, or deploy it to your machine as a local module without uploading it to the registry.

Follow the instructions below to learn how to write a new module using your preferred language and its corresponding [Viam SDK](/sdks/), and then deploy it to your machines.

Expand Down Expand Up @@ -199,7 +199,7 @@ For more Python module examples:
- See the [Python SDK `examples` directory](https://github.com/viamrobotics/viam-python-sdk/tree/main/examples) for sample module code of varying complexity.
- For tutorials featuring modular resource creation, see the [Modular resource examples](/registry/examples/) page.
- For an example featuring a sensor, see [MCP300x](https://github.com/viam-labs/mcp300x-adc-sensor).
- For additional examples use the [modular resources search](/registry/#modular-resources) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.
- For additional examples use the [modular resources search](/registry/modular-resources/) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.

{{% /tab %}}
{{% tab name="Go" %}}
Expand All @@ -214,7 +214,7 @@ For more Python module examples:
For more Go module examples:

- See the [Go SDK `examples` directory](https://github.com/viamrobotics/rdk/blob/main/examples/) for sample module code of varying complexity.
- For additional examples use the [modular resources search](/registry/#modular-resources) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.
- For additional examples use the [modular resources search](/registry/modular-resources/) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.

{{% /tab %}}
{{% tab name="C++" %}}
Expand Down Expand Up @@ -685,7 +685,7 @@ func (b *myBase) Close(ctx context.Context) error {
{{< alert title="Note" color="note" >}}
For an example featuring a sensor, see [MCP3004-8](https://github.com/mestcihazal/mcp3004-8-go).

For additional examples use the [modular resources search](/registry/#modular-resources) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.
For additional examples use the [modular resources search](/registry/modular-resources/) to search for examples of the model you are implementing, and click on the model's link to be able to browse its code.
{{< /alert >}}

When implementing built-in methods from the Viam Go SDK in your model, be sure your implementation of those methods returns any values designated in the built-in method's return signature, typed correctly.
Expand Down Expand Up @@ -1478,7 +1478,7 @@ Strings of the form `<INSERT X>` indicate placeholders that you need to replace
````md
# [`<INSERT MODULE NAME>` module](<INSERT LINK TO MODULE REPO>)
This [module](https://docs.viam.com/registry/#modular-resources) implements the [`<INSERT API TRIPLET>` API]<INSERT LINK TO DOCS (if applicable)> in an <INSERT MODEL> model.
This [module](https://docs.viam.com/registry/modular-resources/) implements the [`<INSERT API TRIPLET>` API]<INSERT LINK TO DOCS (if applicable)> in an <INSERT MODEL> model.
With this model, you can...
## Requirements
Expand Down Expand Up @@ -1639,7 +1639,7 @@ Add the module to your machine's config, then add the component or service it im
1. Enter the {{< glossary_tooltip term_id="model-namespace-triplet" text="model namespace triplet">}} of your modular resource's {{< glossary_tooltip term_id="model" text="model" >}}.
{{<imgproc src="registry/configure/add-local-module-create.png" resize="250x" declaredimensions=true alt="The add a component model showing the create a module step for an intel realsense module">}}
{{<imgproc src="registry/modular-resources/add-local-module-create.png" resize="250x" declaredimensions=true alt="The add a component model showing the create a module step for an intel realsense module">}}
1. Enter a name for this instance of your modular resource.
This name must be different from the module name.
Expand All @@ -1662,7 +1662,7 @@ See [How to Upload a Module](/how-tos/upload-module/) for instructions.
You have now created a module, and are ready to deploy it to a fleet of machines.
There are two ways to deploy a module:
- Through the Viam registry: Once you have uploaded your new module to the Viam registry, [add the module to one or more machines in the Viam app](/registry/configure/).
- Through the Viam registry: Once you have uploaded your new module to the Viam registry, [add the module to one or more machines in the Viam app](/registry/modular-resources/).
You can also choose to configure [automated uploads for new module versions](/how-tos/manage-modules/#update-an-existing-module-using-a-github-action) through a continuous integration (CI) workflow, using a GitHub Action if desired, greatly simplifying how you push changes to your module to the registry as you make them.
- As a local module (without uploading it to the Viam app), as you did in the [Test your module locally step above](#test-your-module-locally).
This is a great way to test, but if you'd like to use the module on more machines it's easiest to add it to the registry either publicly or privately.
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/detect-people.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ In the resulting ML model service configuration pane, ensure that **Deploy model
Then click on **Select model**, switch to the **Registry** tab and select the **people** model by **ml-models-scuttle** to deploy a model that has been trained to be able to detect people.
This model is a TFLite model.

For more detailed information, including optional attribute configuration, see the [`tflite_cpu` docs](/services/ml/deploy/tflite_cpu/).
For more detailed information, including optional attribute configuration, see the [`tflite_cpu` docs](/services/ml/tflite_cpu/).

{{% /expand%}}
{{%expand "Step 5: Configure a vision service" %}}
Expand Down
4 changes: 2 additions & 2 deletions docs/how-tos/image-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ Contributors have written several filtering {{< glossary_tooltip term_id="module
The following steps use the [`filtered_camera`](https://github.com/erh/filtered_camera) module:

{{< table >}}
{{% tablestep link="/services/ml/deploy/"%}}
{{% tablestep link="/services/ml/"%}}
{{<imgproc src="/services/ml/train.svg" class="fill alignleft" style="width: 150px" declaredimensions=true alt="Train models">}}
**1. Add an ML model service to your machine**

Add an ML model service on your machine that is compatible with the ML model you want to use, for example [TFLite CPU](/services/ml/deploy/tflite_cpu/).
Add an ML model service on your machine that is compatible with the ML model you want to use, for example [TFLite CPU](/services/ml/tflite_cpu/).

{{% /tablestep %}}
{{% tablestep link="/services/vision/"%}}
Expand Down
4 changes: 2 additions & 2 deletions docs/how-tos/manage-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ After you [create and deploy a module](/how-tos/create-module/), you may need to

{{% /alert %}}

For information on pinning module deployments to versions, see [Configuring version update management for a registry module](/registry/configure/#configure-version-update-management-for-a-registry-module).
For information on pinning module deployments to versions, see [Module versioning](/registry/modular-resources/#module-versioning).

## Update an existing module

Expand Down Expand Up @@ -425,7 +425,7 @@ To upload another version, you must increment the version number to a later vers
## Next steps

{{< cards >}}
{{% manualcard link="/registry/configure/#configure-version-update-management-for-a-registry-module" %}}
{{% manualcard link="/registry/modular-resources/#module-versioning" %}}
{{<imgproc src="/registry/create-module.svg" declaredimensions=true alt="Gear icon" >}}

<br>
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/performance-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ You must run `viam-server` with `sudo` to monitor machine performance metrics.
## Add the telegraf-sensor

{{< table >}}
{{% tablestep link="/registry/configure/#add-a-modular-resource-from-the-viam-registry" %}}
{{% tablestep link="/registry/modular-resources/#configuration" %}}
**1. Add the performance metrics sensor**

On your machine's **CONFIGURE** page, click the **+** icon next to your machine part in the left-hand menu and select **Component**.
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/sensor-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ With this model, you can gather [Open-Meteo](https://open-meteo.com/en/docs/air-

## Build and Run

To use this module, follow these instructions to [add a module from the Viam Registry](https://docs.viam.com/registry/configure/#add-a-modular-resource-from-the-viam-registry) and select the `rdk:sensor:jessamy:weather:meteo_PM` model from the [`jessamy:weather:meteo_PM` module](https://app.viam.com/module/rdk/jessamy:weather:_PM).
To use this module, add it from the machines **CONFIGURE** tab and select the `rdk:sensor:jessamy:weather:meteo_PM` model from the [`jessamy:weather:meteo_PM` module](https://app.viam.com/module/rdk/jessamy:weather:_PM).

## Configure your `meteo_PM` sensor

Expand Down
4 changes: 2 additions & 2 deletions docs/how-tos/train-deploy-ml.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ In the Viam app, navigate to your list of [**DATASETS**](https://app.viam.com/da

Click **Train model** and follow the prompts.

You can train your model using **Built-in training** or using a [training script](/services/ml/training-scripts/) from the Viam Registry.
You can train your model using **Built-in training** or using a [training script](/registry/training-scripts/) from the Viam Registry.

Click **Next steps**.

Expand Down Expand Up @@ -559,7 +559,7 @@ On its own the ML model service only runs the model.
To use it to make inferences on a camera stream, you need to use it alongside a vision service.

{{< table >}}
{{% tablestep link="/services/ml/deploy/" %}}
{{% tablestep link="/services/ml/" %}}
{{<imgproc src="/registry/upload-module.svg" class="fill alignleft" style="width: 150px" declaredimensions=true alt="Train models">}}
**1. Deploy your ML model**

Expand Down
2 changes: 1 addition & 1 deletion docs/platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ And you can use the following platform capabilities and services to make your ma

{{< cards >}}
{{% relatedcard link="/services/data" %}}
{{% relatedcard link="/services/ml/deploy" alt_title="Machine Learning" %}}
{{% relatedcard link="/services/ml" alt_title="Machine Learning" %}}
{{% relatedcard link="/services/motion" %}}
{{% relatedcard link="/services/navigation" %}}
{{% relatedcard link="/services/slam" %}}
Expand Down
Loading

0 comments on commit b8b0647

Please sign in to comment.