Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion llama_cpp/_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ def __init__(
)

if model is None:
raise ValueError(f"Failed to load model from file: {path_model}")
try:
size_hint = f" (file size: {os.path.getsize(path_model) / (1024**3):.1f} GB)"
except OSError:
size_hint = ""
raise ValueError(
f"Failed to load model from file: {path_model}{size_hint}.
"
"Common causes: insufficient RAM or VRAM for the model size, "
"unsupported quantization format, or corrupt file.
"
"Tip: set verbose=True to see the full llama.cpp log, "
"or use n_gpu_layers=-1 to offload layers to GPU."
)

vocab = llama_cpp.llama_model_get_vocab(model)

Expand Down