Spaces:
Runtime error
Runtime error
# 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." |