Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running GPT4ALL model: TypeError: Model.generate() got an unexpected keyword argument 'new_text_callback' #4126

Closed
ooo27 opened this issue May 4, 2023 · 6 comments

Comments

@ooo27
Copy link

ooo27 commented May 4, 2023

Sample code:

from langchain.llms import GPT4All
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler

gpt4all_model_path = "./models/ggml-gpt4all-l13b-snoozy.bin"

template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate(template=template, input_variables=["question"])
callbacks = [StreamingStdOutCallbackHandler()]
llm = GPT4All(model=gpt4all_model_path, callbacks=callbacks, verbose=True)
llm_chain = LLMChain(prompt=prompt, llm=llm)
question = "What is your quest?"
llm_chain.run(question)

Error during initialization:

  File "e:\src\lgtest\game_actor.py", line 27, in <module>
    llm_chain.run(question)
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\chains\base.py", line 236, in run
    return self(args[0], callbacks=callbacks)[self.output_keys[0]]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\chains\base.py", line 140, in __call__
    raise e
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\chains\base.py", line 134, in __call__
    self._call(inputs, run_manager=run_manager)
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\chains\llm.py", line 69, in _call
    response = self.generate([inputs], run_manager=run_manager)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\chains\llm.py", line 79, in generate
    return self.llm.generate_prompt(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\llms\base.py", line 127, in generate_prompt
    return self.generate(prompt_strings, stop=stop, callbacks=callbacks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\llms\base.py", line 176, in generate
    raise e
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\llms\base.py", line 170, in generate
    self._generate(prompts, stop=stop, run_manager=run_manager)
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\llms\base.py", line 377, in _generate
    self._call(prompt, stop=stop, run_manager=run_manager)
  File "e:\src\lgtest\.venv\Lib\site-packages\langchain\llms\gpt4all.py", line 186, in _call
    text = self.client.generate(
           ^^^^^^^^^^^^^^^^^^^^^
TypeError: Model.generate() got an unexpected keyword argument 'new_text_callback'```
@ooo27
Copy link
Author

ooo27 commented May 4, 2023

I was able to fix it, PR here. #4136

@alanredmaiar
Copy link

Is not working yet. Some suggestion maybe using previous releases?

@jackxwu
Copy link

jackxwu commented May 6, 2023

i still get this error on langChain==0.0.160. opened issue# #4220 @ooo27

@rafaeldelrey
Copy link

rafaeldelrey commented May 6, 2023

Temporary workaround is to downgrade pygpt4all
pip install --upgrade pygpt4all==1.0.1

vowelparrot pushed a commit that referenced this issue May 6, 2023
…#4131)

Fix for these issues:
#4126

#3839 (comment)

---------

Co-authored-by: Pawel Faron <ext-pawel.faron@vaisala.com>
@g0dEngineer
Copy link

I was able to fix it, PR here. #4136

That works!

@dosubot
Copy link

dosubot bot commented Sep 15, 2023

Hi, @ooo27! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you encountered a TypeError during the initialization of the GPT4ALL model, specifically "Model.generate() got an unexpected keyword argument 'new_text_callback'". You were able to fix the issue and submitted a pull request. TatanParker suggested using previous releases as a temporary solution, while rafaeldelrey recommended downgrading pygpt4all to version 1.0.1. Another user, jackxwu, also opened a new issue with the same error.

Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution and for bringing this issue to our attention. Let us know if there's anything else we can assist you with!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 15, 2023
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants