forked from kherud/java-llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvalidate-models.bat
More file actions
36 lines (27 loc) · 1.16 KB
/
Copy pathvalidate-models.bat
File metadata and controls
36 lines (27 loc) · 1.16 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
@echo off
REM Validate that all required model files exist and are valid GGUF files
REM GGUF files start with magic bytes: 0x47 0x47 0x55 0x46 ("GGUF")
setlocal enabledelayedexpansion
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"
echo Validating model files...
for %%M in (%MODELS%) do (
if not exist "%%M" (
echo ERROR: Model not found: %%M
exit /b 1
)
REM Check file size using PowerShell
for /f %%S in ('powershell -Command "(Get-Item '%%M').Length"') do set "size=%%S"
if !size! lss 4 (
echo ERROR: Model file too small (likely corrupted^): %%M (size: !size! bytes^)
exit /b 1
)
REM Check GGUF magic bytes using PowerShell: 47475546 in hex = GGUF in ASCII
for /f %%H in ('powershell -Command "[System.BitConverter]::ToString((Get-Content '%%M' -Encoding Byte -ReadCount 4)[0]) -replace '-',''"') do set "magic=%%H"
if not "!magic!"=="47475546" (
echo ERROR: Invalid GGUF magic bytes in %%M (got: !magic!, expected: 47475546^)
exit /b 1
)
echo OK: %%M ^(!size! bytes^)
)
echo All models validated successfully!
exit /b 0