Files
bi100_contest-03/vllm/transformers_utils/utils.py
4paradigm 780b5e1ff4
Some checks failed
Docker Build and Push / docker (push) Failing after 2m10s
Initial commit
2026-07-24 15:17:23 +08:00

17 lines
396 B
Python

from os import PathLike
from pathlib import Path
from typing import Union
def check_gguf_file(model: Union[str, PathLike]) -> bool:
"""Check if the file is a GGUF model."""
model = Path(model)
if not model.is_file():
return False
elif model.suffix == ".gguf":
return True
with open(model, "rb") as f:
header = f.read(4)
return header == b"GGUF"