File size: 1,131 Bytes
b61ac8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

# Exit on first error
set -e

# Check if HF_TOKEN is set
if [ -z "$HF_TOKEN" ]; then
  echo "Error: HF_TOKEN environment variable not set."
  exit 1
fi

# Set model details
MODEL_NAME="second-state/Qwen3-0.6B-GGUF"
MODEL_BASENAME="Qwen3-0.6B-Q4_K_S.gguf"
MODEL_PATH="/app/models"
MODEL_FILE="$MODEL_PATH/$MODEL_BASENAME"

# Create model directory
mkdir -p "$MODEL_PATH"

# Check if the model file already exists
if [ -f "$MODEL_FILE" ]; then
  echo "Model file already exists: $MODEL_FILE"
else
  # Download model file with HF_TOKEN
  echo "Downloading model: $MODEL_BASENAME"
  curl -L "https://huggingface.co/${MODEL_NAME}/resolve/main/${MODEL_BASENAME}?token=$HF_TOKEN" -o "$MODEL_FILE"
  if [ $? -ne 0 ]; then
    echo "Error: Failed to download model."
    exit 1
  fi
  echo "Model download complete."
fi

# VERIFIKASI FILE YANG DIUNDUH 
echo "Verifying downloaded file..."
du -h "$MODEL_FILE"  # Cek ukuran file
if [ -s "$MODEL_FILE" ]; then
    echo "File size is non-zero."
else
    echo "Error: File size is zero!"
    exit 1
fi

#VERIFIKASI MD5 CHECKSUM #Hapus MD5 checksum

echo "Download script finished."