Rust WASM Neural Net PART 4 - Other Stuff
API
The API1 is super simple.
MNIST Data2
I create some basic endpoints for get a sample of MNIST or a block of MNIST samples3.
Weights
I create some endpoints for dealing with the model weights stored in the API.
- GET - get the weights stored in the API
- POST - put some weights in the API
- PATCH - send some data, and have the API update the weights by training on that data block
- DELETE - delete the weights in the API, and have it refresh itself by retraining for some iterations4
Other API functions
I put some semi-useful stuff into logs5:
- Times weights are cleared
- Accuracy of the model
- Some information about the data
Deployment
I use my cluster6 to deploy the API and site7. There are docker images for the api and site8.
You can build this yourself with a simple docker compose up --build
.
Image details
I made some semi-interesting optimizations to get rid of the space intensive build artifacts.
At the end the API image just contains the final API binary, data, and some weights. The site image just contains the static objects needed to serve the site (with an nginx base image).
Final Links
And this short posts summarizes this project. To see the project in action check out my deployment.
-
Yann LeCun still hosts the original data ↩︎
-
I do this mostly for convenience of types. It could live under one endpoint. ↩︎
-
These are built through github actions that lint, test, and build the codebase ↩︎