forked from kherud/java-llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvalidate-models.sh
More file actions
executable file
·38 lines (31 loc) · 1.08 KB
/
Copy pathvalidate-models.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.08 KB
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
#!/bin/bash
# Validate that all required model files exist and are valid GGUF files
# GGUF files start with magic bytes: 0x47 0x47 0x55 0x46 ("GGUF")
set -e
MODELS=(
"models/codellama-7b.Q2_K.gguf"
"models/jina-reranker-v1-tiny-en-Q4_0.gguf"
"models/AMD-Llama-135m-code.Q2_K.gguf"
"models/Qwen3-0.6B-Q4_K_M.gguf"
)
echo "Validating model files..."
for model in "${MODELS[@]}"; do
if [[ ! -f "$model" ]]; then
echo "ERROR: Model not found: $model"
exit 1
fi
# Check file size (must be > 4 bytes for magic header)
size=$(stat -f%z "$model" 2>/dev/null || stat -c%s "$model" 2>/dev/null)
if [[ $size -lt 4 ]]; then
echo "ERROR: Model file too small (likely corrupted): $model (size: $size bytes)"
exit 1
fi
# Check GGUF magic bytes: 0x47 0x47 0x55 0x46
magic=$(xxd -p -l 4 "$model")
if [[ "$magic" != "47475546" ]]; then
echo "ERROR: Invalid GGUF magic bytes in $model (got: $magic, expected: 47475546)"
exit 1
fi
echo "✓ $model ($(numfmt --to=iec-i --suffix=B $size 2>/dev/null || echo $size bytes))"
done
echo "All models validated successfully!"