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:

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry πŸ•’

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more β†’

Top comments (1)

Collapse
 
yukikimoto profile image
Yuki Kimoto β€’

Please feel free to comment.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay