Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,31 @@ jobs:
key-id: ${{ secrets.viam_key_id }}
key-value: ${{ secrets.viam_key_value }}

publish-windows:
needs: validate-tag
name: Build and Upload Windows module
runs-on: ${{ matrix.build_target.built_on }}
strategy:
matrix:
build_target:
- platform: windows/amd64
built_on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: go build -a -o module.exe ./cmd/module
- name: Package
run: tar -czf module.tar.gz module.exe third_party/onnxruntime.dll
- name: Install Viam CLI
run: |
Invoke-WebRequest -Uri "https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-latest-windows-amd64.exe" -OutFile "viam.exe"
- name: Publish build to Viam registry
run: |
.\viam.exe login api-key --key-id ${{ secrets.viam_key_id }} --key ${{ secrets.viam_key_value }}
.\viam.exe module upload --platform ${{ matrix.build_target.platform }} --version ${{ github.ref_name }} module.tar.gz

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lint:

module.tar.gz:
ifeq ($(VIAM_TARGET_OS),windows) # this needs to be at the top since windows is emulated
GOOS=windows GOARCH=amd64 go build -a -o module.exe ./cmd/module
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -a -o module.exe ./cmd/module
jq '.entrypoint = "module.exe"' meta.json > temp.json && mv temp.json meta.json
tar -czf $@ module.exe third_party/onnxruntime.dll meta.json
else ifeq ($(MOD_OS),Darwin)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before configuring your ML model, you must [create a machine](https://docs.viam.

## 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 `viam-labs:mlmodel:onnx-cpu` model from the [`onnx-cpu` module](https://github.com/viam-labs/onnx-cpu).
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 `viam:mlmodel:onnx-cpu` model from the [`onnx-cpu` module](https://github.com/viam-modules/onnx-cpu).

## Configure your `onnx-cpu` ML model

Expand All @@ -37,7 +37,7 @@ If you prefer to configure your service using JSON, use the following attributes

### Attributes

The following attributes are available for the `viam-labs:mlmodel:onnx-cpu` ML model service:
The following attributes are available for the `viam:mlmodel:onnx-cpu` ML model service:

| Name | Type | Inclusion | Description |
| ------- | ------ | ------------ | ----------- |
Expand All @@ -53,7 +53,7 @@ The following attributes are available for the `viam-labs:mlmodel:onnx-cpu` ML m
{
"name": "onnx",
"type": "mlmodel",
"model": "viam-labs:mlmodel:onnx-cpu",
"model": "viam:mlmodel:onnx-cpu",
"attributes": {
"model_path": "/path/to/onnx_file/detector_googlenet.onnx"
"label_path": "/path/to/labels.txt"
Expand Down Expand Up @@ -116,7 +116,7 @@ tar -czf module.tar.gz module third_party/

For Android, the Makefile will create the tar file.

You can then add the module to app.viam.com locally. the model triplet is `viam-labs:mlmodel:onnx-cpu`.
You can then add the module to app.viam.com locally. the model triplet is `viam:mlmodel:onnx-cpu`.

## License

Expand Down
2 changes: 1 addition & 1 deletion cmd/module/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"go.viam.com/rdk/module"
"go.viam.com/rdk/services/mlmodel"

onnx "github.com/viam-labs/onnx-cpu"
onnx "github.com/viam-modules/onnx-cpu"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/viam-labs/onnx-cpu
module github.com/viam-modules/onnx-cpu

go 1.25.1

Expand Down
2 changes: 1 addition & 1 deletion meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"module_id": "viam:onnx-cpu",
"build": {
"build": "make module.tar.gz",
"arch" : ["linux/amd64", "linux/arm64", "darwin/arm64", "windows/amd64"]
"arch" : ["linux/amd64", "linux/arm64", "darwin/arm64"]
},
"visibility": "public",
"url": "https://github.com/viam-modules/onnx-cpu",
Expand Down
2 changes: 1 addition & 1 deletion onnx_cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

// Model is the name of the module
var Model = resource.ModelNamespace("viam-labs").WithFamily("mlmodel").WithModel("onnx-cpu")
var Model = resource.ModelNamespace("viam").WithFamily("mlmodel").WithModel("onnx-cpu")

// DataTypeMap maps the long ONNX data type labels to the data type as written in Go.
var DataTypeMap = map[ort.TensorElementDataType]string{
Expand Down