model_zoo_executor

command
v0.0.0-...-fdabbf2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

About

This is a simple utility that runs a model from the model zoo thanks to the Gorgonia backend

Example

Download a pre-trained model from the zoo (for now, only MNIST is known to work)

then smply run:

go run main.go -model /tmp/mnist/model.onnx -input /tmp/mnist/test_data_set_0/input_0.pb -output /tmp/mnist/test_data_set_0/output_0.pb

The utility evaluates the model and check if the computed output is equal to the expected output (within a delta of 5e-3). If the result is ok, it displays the result:

[975.67035 -618.7244 6574.5684 668.0278 -917.27057 -1671.6357 -1952.7606 -61.54949 -777.17645 -1439.5311]

Test files

You can test (and bench a model) with go test. Simply download a model from the zoo into a subdirectory of the ./models dir; then run:

MODELDIR=./models/YOURMODEL go test

If you have several models inside the ./models dir, you can run them all by typing make

Bench

A simple benchmark that measures the execution time of the model is also included; to run it:

MODELDIR=./models/YOURMODEL go test -bench=.

Profiling

You can also use this benchmark for profiling the application:

MODELDIR=models/YOURMODEL go test -bench=. -benchmem -memprofile memprofile.out -cpuprofile profile.out -benchtime=10s

The use the pprof tool:

go tool pprof -http=localhost:3999 memprofile.out or go tool pprof -http=localhost:3999 profile.out

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL