File size: 881 Bytes
db36c54
 
6c8ec2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db36c54
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os

# download the model files
download_files = """
wget https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-simple.wasm -O llama-simple.wasm &&
wget https://huggingface.co/hoorang/Llama-3.1-8B-Instruct-Q5_K_M-GGUF/raw/main/llama-3.1-8b-instruct-q5_k_m.gguf -O Meta-Llama-3.1-8B-Instruct-Q5_K_M.gguf
"""
os.system(download_files)


# Install WasmEdge
install_command = """
wget https://github.com/WasmEdge/WasmEdge/releases/download/0.12.1/WasmEdge-0.12.1-Linux.tar.gz &&
tar -xvzf WasmEdge-0.12.1-Linux.tar.gz &&
sudo cp WasmEdge-0.12.1-Linux/bin/* /usr/local/bin/
"""
os.system(install_command)

# Run the WasmEdge command
command = "wasmedge --dir .:. --nn-preload default:GGML:AUTO:Meta-Llama-3.1-8B-Instruct-Q5_K_M.gguf llama-simple.wasm --n-predict 128 --log-enable --prompt 'Robert Oppenheimer's most important achievement is '"
os.system(command)