chatglm.cpp icon indicating copy to clipboard operation
chatglm.cpp copied to clipboard

ChatGLM3 使用 examples/cli_demo.py 时报错 'TypeError: chat() got an unexpected keyword argument 'max_new_tokens''

Open Legalgeek opened this issue 1 year ago • 1 comments

examples git:(main) python3 cli_demo.py -m ../chatglm3-ggml.bin -p 你好 --temp 0.8 --top_p 0.8
Traceback (most recent call last):
  File "/Users/XXX/Documents/git/chatGLM/chatglm.cpp/examples/cli_demo.py", line 155, in <module>
    main()
  File "/Users/XXX/Documents/git/chatGLM/chatglm.cpp/examples/cli_demo.py", line 93, in main
    for chunk in pipeline.chat(messages, **generation_kwargs):
TypeError: chat() got an unexpected keyword argument 'max_new_tokens'

Legalgeek avatar Dec 17 '23 15:12 Legalgeek

我也遇到这个问题,然后改了下下面的代码就好了:

     generation_kwargs = dict(
         max_length=args.max_length,
-        max_new_tokens=args.max_new_tokens,
+        # max_new_tokens=args.max_new_tokens,
         max_context_length=args.max_context_length,
         do_sample=args.temp > 0,
         top_k=args.top_k,

zhaozhiming avatar Dec 20 '23 02:12 zhaozhiming