Skip to content

Commit

Permalink
python: init_gpu fixes (#2368)
Browse files Browse the repository at this point in the history
* python: tweak GPU init failure message
* llama.cpp: update submodule for use-after-free fix

Signed-off-by: Jared Van Bortel <[email protected]>
  • Loading branch information
cebtenzzre authored May 20, 2024
1 parent e021fe1 commit c779d8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gpt4all-backend/llama.cpp-mainline
9 changes: 5 additions & 4 deletions gpt4all-bindings/python/gpt4all/_pyllmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,12 @@ def init_gpu(self, device: str):

all_gpus = self.list_gpus()
available_gpus = self.list_gpus(mem_required)
unavailable_gpus = set(all_gpus).difference(available_gpus)
unavailable_gpus = [g for g in all_gpus if g not in available_gpus]

error_msg = "Unable to initialize model on GPU: {!r}".format(device)
error_msg += "\nAvailable GPUs: {}".format(available_gpus)
error_msg += "\nUnavailable GPUs due to insufficient memory or features: {}".format(unavailable_gpus)
error_msg = (f"Unable to initialize model on GPU: {device!r}" +
f"\nAvailable GPUs: {available_gpus}")
if unavailable_gpus:
error_msg += f"\nUnavailable GPUs due to insufficient memory: {unavailable_gpus}"
raise ValueError(error_msg)

def load_model(self) -> bool:
Expand Down

0 comments on commit c779d8a

Please sign in to comment.