Skip to content

Commit 90410bb

Browse files
Merge pull request #189 from bernardladenthin/claude/stoic-archimedes-brMrb
Add per-session thread-safety and streaming guard to Session
2 parents 92a4e1f + 5624e83 commit 90410bb

22 files changed

Lines changed: 1531 additions & 99 deletions

.github/validate-models.bat

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ setlocal enabledelayedexpansion
1111

1212
set "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"
1313

14-
echo Validating model files...
14+
REM Vision GGUFs are validated only when present (the Windows job downloads
15+
REM them too, but the validation step must not fail when a future job opts
16+
REM out of the vision matrix).
17+
set "OPTIONAL_MODELS=models\SmolVLM-500M-Instruct-Q8_0.gguf" "models\mmproj-SmolVLM-500M-Instruct-Q8_0.gguf"
18+
19+
echo Validating required model files...
1520
for %%M in (%MODELS%) do (
1621
if not exist "%%M" (
1722
echo ERROR: Model not found: %%M
@@ -37,5 +42,24 @@ for %%M in (%MODELS%) do (
3742
echo OK: %%M ^(!size! bytes^)
3843
)
3944

45+
echo Validating optional vision model files...
46+
for %%M in (%OPTIONAL_MODELS%) do (
47+
if not exist "%%M" (
48+
echo SKIP: %%M not present
49+
) else (
50+
for /f %%S in ('powershell -Command "(Get-Item '%%M').Length"') do set "size=%%S"
51+
if !size! lss 4 (
52+
echo ERROR: Model file too small (likely corrupted^): %%M (size: !size! bytes^)
53+
exit /b 1
54+
)
55+
for /f %%H in ('powershell -Command "[System.BitConverter]::ToString((Get-Content '%%M' -Encoding Byte -ReadCount 4)[0]) -replace '-',''"') do set "magic=%%H"
56+
if not "!magic!"=="47475546" (
57+
echo ERROR: Invalid GGUF magic bytes in %%M (got: !magic!, expected: 47475546^)
58+
exit /b 1
59+
)
60+
echo OK: %%M ^(!size! bytes^)
61+
)
62+
)
63+
4064
echo All models validated successfully!
4165
exit /b 0

.github/validate-models.sh

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,49 @@ MODELS=(
1717
"models/Qwen3-0.6B-Q4_K_M.gguf"
1818
)
1919

20-
echo "Validating model files..."
21-
for model in "${MODELS[@]}"; do
20+
# Optional GGUFs validated only when present so jobs that do not download
21+
# them (e.g. cross-compile smoke runs) still pass. The vision test image is
22+
# committed to src/test/resources/images/test-image.jpg and is not validated
23+
# here — its presence is asserted directly by MultimodalIntegrationTest.
24+
OPTIONAL_MODELS=(
25+
"models/nomic-embed-text-v1.5.f16.gguf"
26+
"models/SmolVLM-500M-Instruct-Q8_0.gguf"
27+
"models/mmproj-SmolVLM-500M-Instruct-Q8_0.gguf"
28+
)
29+
30+
validate_gguf() {
31+
local model="$1"
32+
local required="$2"
2233
if [[ ! -f "$model" ]]; then
23-
echo "ERROR: Model not found: $model"
24-
exit 1
34+
if [[ "$required" == "required" ]]; then
35+
echo "ERROR: Model not found: $model"
36+
exit 1
37+
else
38+
echo "- $model (optional, skipped: not present)"
39+
return
40+
fi
2541
fi
26-
27-
# Check file size (must be > 4 bytes for magic header)
42+
local size
2843
size=$(stat -f%z "$model" 2>/dev/null || stat -c%s "$model" 2>/dev/null)
2944
if [[ $size -lt 4 ]]; then
3045
echo "ERROR: Model file too small (likely corrupted): $model (size: $size bytes)"
3146
exit 1
3247
fi
33-
34-
# Check GGUF magic bytes: 0x47 0x47 0x55 0x46
48+
local magic
3549
magic=$(xxd -p -l 4 "$model")
3650
if [[ "$magic" != "47475546" ]]; then
3751
echo "ERROR: Invalid GGUF magic bytes in $model (got: $magic, expected: 47475546)"
3852
exit 1
3953
fi
40-
4154
echo "$model ($(numfmt --to=iec-i --suffix=B $size 2>/dev/null || echo $size bytes))"
55+
}
56+
57+
echo "Validating model files..."
58+
for model in "${MODELS[@]}"; do
59+
validate_gguf "$model" required
60+
done
61+
for model in "${OPTIONAL_MODELS[@]}"; do
62+
validate_gguf "$model" optional
4263
done
4364

4465
echo "All models validated successfully!"

0 commit comments

Comments
 (0)