Spaces:
Runtime error
Runtime error
Create download-model.sh
Browse files- download-model.sh +47 -0
download-model.sh
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Exit on first error
|
4 |
+
set -e
|
5 |
+
|
6 |
+
# Check if HF_TOKEN is set
|
7 |
+
if [ -z "$HF_TOKEN" ]; then
|
8 |
+
echo "Error: HF_TOKEN environment variable not set."
|
9 |
+
exit 1
|
10 |
+
fi
|
11 |
+
|
12 |
+
# Set model details
|
13 |
+
MODEL_NAME="second-state/Qwen3-0.6B-GGUF"
|
14 |
+
MODEL_BASENAME="Qwen3-0.6B-Q4_K_S.gguf"
|
15 |
+
MODEL_PATH="/app/models"
|
16 |
+
MODEL_FILE="$MODEL_PATH/$MODEL_BASENAME"
|
17 |
+
|
18 |
+
# Create model directory
|
19 |
+
mkdir -p "$MODEL_PATH"
|
20 |
+
|
21 |
+
# Check if the model file already exists
|
22 |
+
if [ -f "$MODEL_FILE" ]; then
|
23 |
+
echo "Model file already exists: $MODEL_FILE"
|
24 |
+
else
|
25 |
+
# Download model file with HF_TOKEN
|
26 |
+
echo "Downloading model: $MODEL_BASENAME"
|
27 |
+
curl -L "https://huggingface.co/${MODEL_NAME}/resolve/main/${MODEL_BASENAME}?token=$HF_TOKEN" -o "$MODEL_FILE"
|
28 |
+
if [ $? -ne 0 ]; then
|
29 |
+
echo "Error: Failed to download model."
|
30 |
+
exit 1
|
31 |
+
fi
|
32 |
+
echo "Model download complete."
|
33 |
+
fi
|
34 |
+
|
35 |
+
# VERIFIKASI FILE YANG DIUNDUH
|
36 |
+
echo "Verifying downloaded file..."
|
37 |
+
du -h "$MODEL_FILE" # Cek ukuran file
|
38 |
+
if [ -s "$MODEL_FILE" ]; then
|
39 |
+
echo "File size is non-zero."
|
40 |
+
else
|
41 |
+
echo "Error: File size is zero!"
|
42 |
+
exit 1
|
43 |
+
fi
|
44 |
+
|
45 |
+
#VERIFIKASI MD5 CHECKSUM #Hapus MD5 checksum
|
46 |
+
|
47 |
+
echo "Download script finished."
|