DEV Community

Yuki Kimoto
Yuki Kimoto

Posted on

3

How to generate an executable file for an AI program using SPVM ?

Wouldn't you like to output a single executable file from your AI program? Then, you can run the AI ​​program just by copying the executable file to the Raspberry Pi. Here's how to achieve this using SPVM. Here's an example of image recognition using MINIST as an example of AI using deep learning.

SPVM program

This is an AI program to recognize images using MINIST data.

It is writen by SPVM and SPVM::R.

Install dependent modules.

cpanm SPVM
cpanm SPVM::Errno
cpanm SPVM::File::Basename
cpanm SPVM::File::Spec
cpanm SPVM::FindBin
cpanm SPVM::Math
cpanm SPVM::Regex
cpanm SPVM::Sys
cpanm SPVM::Time::Local
cpanm SPVM::Time::Piece
cpanm SPVM::IO
cpanm SPVM::R

Execute an SPVM program.

spvm -I network_lib/SPVM my_minist_app.spvm

Generate an executable file and execute it.

spvmcc -I network_lib/SPVM -o my_minist_app my_minist_app.spvm

./my_minist_app

I'm not an AI expert, but if you are, I think you can modify this.

If you're interested in parallelization using threads and goroutines, see also:

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (1)

Collapse
 
yukikimoto profile image
Yuki Kimoto

Please feel free to comment.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more