Spaces:
Sleeping
Sleeping
Create run.sh
Browse files
run.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
N_GPU_LAYERS="${N_GPU_LAYERS:-10}"
|
| 4 |
+
MODEL_PATH="${MODEL_PATH:-/data/models/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
|
| 5 |
+
MODEL_URL="${MODEL_URL:-https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF/resolve/main/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
|
| 6 |
+
PORT="${PORT:-7860}"
|
| 7 |
+
CONTEXT="${CONTEXT:-32768}"
|
| 8 |
+
|
| 9 |
+
# Function to print download progress
|
| 10 |
+
print_progress() {
|
| 11 |
+
local percentage=$1
|
| 12 |
+
echo "Download progress: $percentage%"
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
calculate_progress() {
|
| 16 |
+
local current=$1
|
| 17 |
+
local total=$2
|
| 18 |
+
echo "scale=2; $current / $total * 100" | bc
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
# Check if the file exists
|
| 22 |
+
if [ ! -e "$MODEL_PATH" ]; then
|
| 23 |
+
echo "Downloading model."
|
| 24 |
+
wget -q -O "$MODEL_PATH" "$MODEL_URL"
|
| 25 |
+
echo "Model downloaded."
|
| 26 |
+
else
|
| 27 |
+
echo "File already exists."
|
| 28 |
+
fi
|
| 29 |
+
cd /app
|
| 30 |
+
./server -m "$MODEL_PATH" -c $CONTEXT --port $PORT --host 0.0.0.0 --n-gpu-layers $N_GPU_LAYERS --path "/app/public"
|