Skip to content

Latest commit

 

History

History
142 lines (109 loc) · 4.09 KB

README.md

File metadata and controls

142 lines (109 loc) · 4.09 KB

Tests Build binary release Clippy Rustfmt publish to Dockerhub Benchmark

Individual Project 3 - Rust micro-server for Text Summarization

This project aims to build a Rust micro-server that summarizes text, based on the common task of reading and summarizing books among students. The project uses the rust actix and libtorch to run a pre-trained hugging-face model for summarization. Compared with the Individual Project 2, this project add more functions such as onnx model with albert models, GPU support for rust-bert, etc.

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. Install the libtorch (for Mac M1), Intel chips users can skip this step
  3. node
brew install [email protected]

Not Mac ARM chips users

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

Mac ARM chips users

  • Build frontend
make frontend 
  • change the path in the Makefile to your libtorch path
export LIBTORCH=/opt/homebrew/Cellar/pytorch/1.13.1 &&export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
  • Run, you can run the rust web app.
make runarm 
  • Release
make release
  • Bench
make bench

CI/CD

Github Actions configured in .github/workflows

GitHub releases

The binary could be downloaded from the release pages. release

Benchmark Results

Benchmark

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

References