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
·73 lines (65 loc) · 2.5 KB
/
Copy pathvalidate-models.sh
File metadata and controls
executable file
·73 lines (65 loc) · 2.5 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
# SPDX-FileCopyrightText: 2023-2025 Konstantin Herud
#
# SPDX-License-Identifier: MIT
# 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
# Every CI Java test job (Linux + all macOS + all Windows) now downloads the full
# model set before validating, and runs the embedding / vision / TTS integration
# tests with their properties set — so all of these are REQUIRED, not optional. A
# missing model is a hard failure here (it would otherwise let an integration test
# silently self-skip). See .github/workflows/publish.yml.
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"
"models/Qwen2.5-1.5B-Instruct-Q4_K_M.gguf"
"models/nomic-embed-text-v1.5.f16.gguf"
"models/SmolVLM-500M-Instruct-Q8_0.gguf"
"models/mmproj-SmolVLM-500M-Instruct-Q8_0.gguf"
"models/OuteTTS-0.2-500M-Q4_K_M.gguf"
"models/WavTokenizer-Large-75-F16.gguf"
)
# Optional GGUFs validated only when present. The vision test image is committed to
# src/test/resources/images/test-image.jpg and is not validated here — its presence
# is asserted directly by MultimodalIntegrationTest. The audio-input model
# (AudioInputIntegrationTest) has no committed clip and no CI download, so that test
# self-skips and its model is intentionally not listed here.
OPTIONAL_MODELS=()
validate_gguf() {
local model="$1"
local required="$2"
if [[ ! -f "$model" ]]; then
if [[ "$required" == "required" ]]; then
echo "ERROR: Model not found: $model"
exit 1
else
echo "- $model (optional, skipped: not present)"
return
fi
fi
local size
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
local magic
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))"
}
echo "Validating model files..."
for model in "${MODELS[@]}"; do
validate_gguf "$model" required
done
for model in "${OPTIONAL_MODELS[@]}"; do
validate_gguf "$model" optional
done
echo "All models validated successfully!"