@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 86cbd2eee9
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 16:00 UTC

[Misc] improve gguf check (#15974)

Signed-off-by: reidliu41 <reid201711@gmail.com> Co-authored-by: reidliu41 <reid201711@gmail.com>

Reid committed Apr 4, 2025 at 09:33 UTC 86cbd2eee97a98df59c531c34d2aeff5a2b5765d
1 file changed +8 -3
vllm/transformers_utils/utils.py
+8 -3
@@ -23,9 +23,14 @@ def check_gguf_file(model: Union[str, PathLike]) -> bool:
23 elif model.suffix == ".gguf":
24 return True
25
26 - with open(model, "rb") as f:
27 - header = f.read(4)
28 - return header == b"GGUF"
26 + try:
27 + with model.open("rb") as f:
28 + header = f.read(4)
29 +
30 + return header == b"GGUF"
31 + except Exception as e:
32 + logger.debug("Error reading file %s: %s", model, e)
33 + return False
34
35
36 def modelscope_list_repo_files(