Spaces:
Build error
Build error
Joeng 2004 commited on
Commit ·
6c8ec2f
1
Parent(s): db36c54
Fix WasmEdge setup and dependencies
Browse files
app.py
CHANGED
|
@@ -1,5 +1,22 @@
|
|
| 1 |
import os
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
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 '"
|
| 4 |
os.system(command)
|
| 5 |
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
+
# download the model files
|
| 4 |
+
download_files = """
|
| 5 |
+
wget https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-simple.wasm -O llama-simple.wasm &&
|
| 6 |
+
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
|
| 7 |
+
"""
|
| 8 |
+
os.system(download_files)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Install WasmEdge
|
| 12 |
+
install_command = """
|
| 13 |
+
wget https://github.com/WasmEdge/WasmEdge/releases/download/0.12.1/WasmEdge-0.12.1-Linux.tar.gz &&
|
| 14 |
+
tar -xvzf WasmEdge-0.12.1-Linux.tar.gz &&
|
| 15 |
+
sudo cp WasmEdge-0.12.1-Linux/bin/* /usr/local/bin/
|
| 16 |
+
"""
|
| 17 |
+
os.system(install_command)
|
| 18 |
+
|
| 19 |
+
# Run the WasmEdge command
|
| 20 |
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 '"
|
| 21 |
os.system(command)
|
| 22 |
|
apt.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
wget
|
| 2 |
+
tar
|
| 3 |
+
sudo
|
| 4 |
+
|