From c6d7124675902e3a2628559d8a2b22c30747f75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8B=88=EC=BD=9C=EB=9D=BC=EC=8A=A4?= Date: Wed, 4 Oct 2023 09:37:30 +0900 Subject: [PATCH] Add 'device' to GPT4All (#11216) Add device to GPT4All - **Description:** GPT4All now supports GPU. This commit adds the option to enable it. - **Issue:** It closes https://github.com/langchain-ai/langchain/issues/10486 --------- Co-authored-by: Harrison Chase --- libs/langchain/langchain/llms/gpt4all.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/langchain/langchain/llms/gpt4all.py b/libs/langchain/langchain/llms/gpt4all.py index 67aa6d49a7..3f9a397ffb 100644 --- a/libs/langchain/langchain/llms/gpt4all.py +++ b/libs/langchain/langchain/llms/gpt4all.py @@ -89,6 +89,9 @@ class GPT4All(LLM): allow_download: bool = False """If model does not exist in ~/.cache/gpt4all/, download it.""" + device: Optional[str] = Field("cpu", alias="device") + """Device name: cpu, gpu, nvidia, intel, amd or DeviceName.""" + client: Any = None #: :meta private: class Config: @@ -141,6 +144,7 @@ class GPT4All(LLM): model_path=model_path or None, model_type=values["backend"], allow_download=values["allow_download"], + device=values["device"], ) if values["n_threads"] is not None: # set n_threads