py: improve README (#1860)

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel 2024-01-21 19:53:55 -05:00 committed by GitHub
parent a9c5f53562
commit b881598166
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,11 +9,17 @@ https://docs.gpt4all.io/gpt4all_python.html
## Installation ## Installation
The easiest way to install the Python bindings for GPT4All is to use pip:
``` ```
pip install gpt4all pip install gpt4all
``` ```
## Local Build Instructions This will download the latest version of the `gpt4all` package from PyPI.
## Local Build
As an alternative to downloading via pip, you may build the Python bindings from source.
### Prerequisites ### Prerequisites
@ -23,25 +29,32 @@ macOS users do not need Vulkan, as GPT4All will use Metal instead.
### Building the python bindings ### Building the python bindings
**NOTE**: If you are doing this on a Windows machine, you must build the GPT4All backend using [MinGW64](https://www.mingw-w64.org/) compiler. 1. Clone GPT4All and change directory:
1. Setup `llmodel`
``` ```
git clone --recurse-submodules https://github.com/nomic-ai/gpt4all.git git clone --recurse-submodules https://github.com/nomic-ai/gpt4all.git
cd gpt4all/gpt4all-backend/ cd gpt4all/gpt4all-backend
mkdir build
cd build
cmake ..
cmake --build . --parallel # optionally append: --config Release
``` ```
Confirm that `libllmodel.*` exists in `gpt4all-backend/build`.
2. Setup Python package 2. Build the backend.
If you are using Windows and have Visual Studio installed:
```
cmake -B build
cmake --build build --parallel --config RelWithDebInfo
```
For all other platforms:
```
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel
```
`RelWithDebInfo` is a good default, but you can also use `Release` or `Debug` depending on the situation.
2. Install the Python package:
``` ```
cd ../../gpt4all-bindings/python cd ../../gpt4all-bindings/python
pip3 install -e . pip install -e .
``` ```
## Usage ## Usage