Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b501665

Browse filesBrowse files
authored
Add validation for tensor_split size exceeding LLAMA_MAX_DEVICES (abetlen#820)
* Add validation for tensor_split size exceeding LLAMA_MAX_DEVICES * reword
1 parent f30aa20 commit b501665
Copy full SHA for b501665

File tree

Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed

‎llama_cpp/llama.py

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ def __init__(
308308
self.tensor_split = tensor_split
309309
self._p_tensor_split = None
310310
if self.tensor_split is not None:
311+
if len(self.tensor_split) > llama_cpp.LLAMA_MAX_DEVICES:
312+
raise ValueError(f"Attempt to split tensors that exceed maximum supported devices. Current LLAMA_MAX_DEVICES={llama_cpp.LLAMA_MAX_DEVICES}")
311313
# Type conversion and expand the list to the length of LLAMA_MAX_DEVICES
312314
FloatArray = ctypes.c_float * llama_cpp.LLAMA_MAX_DEVICES
313315
self._c_tensor_split = FloatArray(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.