PyGPT-J
Official supported Python bindings for GPT4All-J language model based on ggml.
Table of contents
Installation
- 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 .
Usage
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)
GPT4All-J Model
Download the GPT4All-J model.
License
This project is licensed under the MIT License.