From 91156e5a1802b588ab58cb295f3db0d42e4e0cf3 Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 30 Jan 2026 14:31:10 -0500 Subject: [PATCH 1/5] need to enable CGO --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 940914a..5c5a475 100644 --- a/Makefile +++ b/Makefile @@ -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 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) From 243ac64e8841419ecddabd3ae5e4104fcfd9df3f Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 30 Jan 2026 14:40:24 -0500 Subject: [PATCH 2/5] specify compiler too --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c5a475..836d12d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ lint: module.tar.gz: ifeq ($(VIAM_TARGET_OS),windows) # this needs to be at the top since windows is emulated - CGO_ENABLED=1 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) From e68ca123609cd7a95defa9915737addd25afcd5c Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 30 Jan 2026 14:54:08 -0500 Subject: [PATCH 3/5] add windows specific build instructions --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++++++ meta.json | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4faf61..0736742 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} --upload module.tar.gz + diff --git a/meta.json b/meta.json index 633992a..a21fa26 100644 --- a/meta.json +++ b/meta.json @@ -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", From 6163d1d11fb8a5225418da5b52000de965d9cf26 Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 30 Jan 2026 15:06:07 -0500 Subject: [PATCH 4/5] change the namespace to viam from viam-labs --- .github/workflows/publish.yml | 2 +- onnx_cpu.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0736742..da30c42 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -69,5 +69,5 @@ jobs: - 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 }} --upload module.tar.gz + .\viam.exe module upload --platform ${{ matrix.build_target.platform }} --version ${{ github.ref_name }} module.tar.gz diff --git a/onnx_cpu.go b/onnx_cpu.go index af8c7e5..0986385 100644 --- a/onnx_cpu.go +++ b/onnx_cpu.go @@ -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{ From 70611398951dc0c680cb5a49a5257597dfa8e2d6 Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 30 Jan 2026 15:07:57 -0500 Subject: [PATCH 5/5] get rid of -labs --- README.md | 8 ++++---- cmd/module/main.go | 2 +- go.mod | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 365a0e4..20d28cd 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 | | ------- | ------ | ------------ | ----------- | @@ -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" @@ -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 diff --git a/cmd/module/main.go b/cmd/module/main.go index d3f70f6..5a5f4ce 100644 --- a/cmd/module/main.go +++ b/cmd/module/main.go @@ -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() { diff --git a/go.mod b/go.mod index 56a07d8..c8edcb6 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/viam-labs/onnx-cpu +module github.com/viam-modules/onnx-cpu go 1.25.1