app.py: add --device option for GPU support (#1769)

Signed-off-by: Daniel Salvatierra <dsalvat1@gmail.com>
Co-authored-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Daniel Salvatierra 2023-12-20 16:01:03 -05:00 committed by GitHub
parent 528eb1e7ad
commit c72c73a94f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,9 +59,13 @@ def repl(
int,
typer.Option("--n-threads", "-t", help="Number of threads to use for chatbot"),
] = None,
device: Annotated[
str,
typer.Option("--device", "-d", help="Device to use for chatbot, e.g. gpu, amd, nvidia, intel. Defaults to CPU."),
] = None,
):
"""The CLI read-eval-print loop."""
gpt4all_instance = GPT4All(model)
gpt4all_instance = GPT4All(model, device=device)
# if threads are passed, set them
if n_threads is not None: