Official supported Python bindings for GPT4All-J language model based on ggml.
- The easy way is to use the prebuilt wheels
pip install pygptj
- Build it from source:
git clone --recursive https://github.com/abdeladim-s/pygptj && cd pygptj
pip install .
from pygptj.model import Model
def new_text_callback(text):
print(text, end="")
model = Model('./models/ggml-gpt4all-j.bin')
model.generate("Once upon a time, ", n_predict=55, new_text_callback=new_text_callback)
If you don't want to use the callback
, you can get the results from the generate
method once the inference is finished:
generated_text = model.generate("Once upon a time, ", n_predict=55)
print(generated_text)
Download the GPT4All-J model.
This project is licensed under the MIT License.