mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-09 14:35:50 +00:00
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 <hw.chase.17@gmail.com>
This commit is contained in:
parent
92683262f4
commit
c6d7124675
@ -89,6 +89,9 @@ class GPT4All(LLM):
|
|||||||
allow_download: bool = False
|
allow_download: bool = False
|
||||||
"""If model does not exist in ~/.cache/gpt4all/, download it."""
|
"""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:
|
client: Any = None #: :meta private:
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@ -141,6 +144,7 @@ class GPT4All(LLM):
|
|||||||
model_path=model_path or None,
|
model_path=model_path or None,
|
||||||
model_type=values["backend"],
|
model_type=values["backend"],
|
||||||
allow_download=values["allow_download"],
|
allow_download=values["allow_download"],
|
||||||
|
device=values["device"],
|
||||||
)
|
)
|
||||||
if values["n_threads"] is not None:
|
if values["n_threads"] is not None:
|
||||||
# set n_threads
|
# set n_threads
|
||||||
|
Loading…
Reference in New Issue
Block a user