pygpt4all - output full response as string and suppress model parameters? #98
-
How do i export the full response from gpt4all into a single string? And how do i suppress the model parameters (gptj_generate... and gptj_model_load...) from being printed? Thank you. For example, i'm just looking to get the following variable... code:
response
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can export it by simply storing the tokens in a string variable, like the following: from pygpt4all import GPT4All_J
model = GPT4All_J('path/to/ggml-gpt4all-j-v1.3-groovy.bin')
response = ""
for token in model.generate("What do you think about German beer?\n"):
response += token
print(response) Please note that the parameters are printed to do not forget to update the package to the latest version pip install -U pygpt4all |
Beta Was this translation helpful? Give feedback.
@gykung,
You can export it by simply storing the tokens in a string variable, like the following:
Please note that the parameters are printed to
stderr
from the c++ side, it does not affect the generated responsedo not forget to update the package to the latest version