This tutorial is based on this AWS tutorial. In this tutorial, we will install Nvidia driver on AWS EC2 instance and compile and run llama.cpp on it.
Here we use g5.4xlarge
instance with Ubuntu 22.04 AMI, which use Nvidia A10G GPU.
name: github pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v1 # v2 does not have submodules option now |
// Load the model data from a file | |
let model_data: &[u8] = include_bytes!("lite-model_aiy_vision_classifier_food_V1_1.tflite"); | |
// Read the input image data from Tencent Cloud's API gateway | |
let mut buffer = String::new(); | |
io::stdin().read_to_string(&mut buffer).expect("Error reading from STDIN"); | |
let obj: FaasInput = serde_json::from_str(&buffer).unwrap(); | |
let img_buf = base64::decode_config(&(obj.body), base64::STANDARD).unwrap(); | |
// Resize the image to the size needed by the Tensorflow model |
let labels = include_str!("aiy_food_V1_labelmap.txt"); | |
let mut i = 0; | |
let mut max_index: i32 = -1; | |
let mut max_value: u8 = 0; | |
while i < res_vec.len() { | |
let cur = res_vec[i]; | |
if cur > max_value { | |
max_value = cur; | |
max_index = i as i32; |