/rust_transfer_learning

Primary LanguageJupyter NotebookCreative Commons Zero v1.0 UniversalCC0-1.0

Tests Build binary release Clippy Rustfmt publish to Dockerhub Benchmark

Team Project: Rust Micro-Server for transfer learning in image classification

Shuai Zheng, Yilun Wu, Yuchen Cao

This project aims to build a Rust micro-server that image classification. The project is built with Rust, libtorch, and hugging-face pretrained models. The project is deployed on kubernetes. It utilizes advanced AI transfer learning algorithms to classify uploaded images into three categories: normal, violence with a gun, and NSFW. The model is trained in Python, while the server is built in Rust.

Project Goals/Outcomes

  • Develop my Rust micro-service with kubernetes
  • Use Github Codespaces and Copilot
  • Integrate libtorch and 'hugging-face pretrained models' into a Rust web project

Architectural Diagram

image

Demo

Kubernetes Deployment

  • go to the directory K8s
cd K8s
  • create the namespace resume-prod
kubectl create namespace resume-prod

  • apply the yaml files
kubectl apply -f .

image

Docker(Recommended)

  • This repo main branch is automatically published to Dockerhub with CI/CD, you can pull the image from here
docker pull szheng3/sz-rust-ml:latest
  • Run the docker image.
docker run -d -p 8000:8000 szheng3/sz-rust-ml:latest
  • Run the docker image with GPU.
docker run -d -p 8000:8000 szheng3/sz-rust-ml:latest-gpu

Setup Manually

  1. Install rust via rustup
  2. node

Run app

  • Build frontend
make web 
  • Run, you can run the rust web app.
make run 
  • Release
make releasex86
  • Bench
make benchx86

CI/CD

Github Actions configured in .github/workflows

GitHub releases

The binary could be downloaded from the release pages. release

Benchmark Results

Benchmark

Load Test

CPU GPU

Logging

logging

Progress Log

  • Configure Github Codespaces.
  • Initialise Rust project with pretrained model from hugging-face
  • CI/CD with Github Actions
  • Tag and Releases
  • Benchmark
  • kubernetes deployment
  • logging
  • NLP model
  • Computer vision model
  • onnx model

References