Skip to content

Commit 29f76e2

Browse files
author
reidliu41
committed
update it with header
Signed-off-by: reidliu41 <[email protected]>
1 parent 619d0f8 commit 29f76e2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

vllm/transformers_utils/utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ def check_gguf_file(model: Union[str, PathLike]) -> bool:
2020
model = Path(model)
2121
if not model.is_file():
2222
return False
23-
24-
import struct
25-
26-
from gguf.constants import GGUF_MAGIC
23+
elif model.suffix == ".gguf":
24+
return True
2725

2826
try:
2927
with model.open("rb") as f:
30-
first_4_bytes = f.read(4)
31-
if len(first_4_bytes) < 4:
28+
header = f.read(4)
29+
if len(header) < 4:
3230
return False
3331

34-
return struct.unpack("<I", first_4_bytes)[0] == GGUF_MAGIC
32+
return header == b"GGUF"
3533
except Exception as e:
3634
logger.debug("Error reading file %s: %s", model, e)
3735
return False

0 commit comments

Comments
 (0)