abetlen / abetlen/llama-cpp-python

Demo of Interactive Chat ignores antiprompt with gguf

未關閉
#759 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
10.6k
分支
1.4k
PR 合併指標
PR 指標待擷取

描述

# Expected Behavior

I moved after long time from ggmf to gguf using now 0.2.7.

I replaced all the files and tried to run:

https://github.com/abetlen/llama-cpp-python/blob/main/examples/low_level_api/Miku.py

First problem:

Crash since:

https://github.com/abetlen/llama-cpp-python/blob/main/examples/low_level_api/low_level_api_chat_cpp.py#L247C1-L248C1

Seems to need one parameter more, my fix for it was to add it:

_n = llama_cpp.llama_tokenize(self.ctx, prompt.encode("utf8", errors="ignore"), **int(len(prompt))**, _arr, len(_arr), bos)

This is a missmatch which should be easy to reproduce.

However, no matter if I use the fixed 0.2.7 or the old 0.2.6 (without parameter bug above), I end up with the main problem which I try to understand:

# Current Behavior

With ggmf (until latest version), I could run the code in a jupyter cell and the result was that the text stopped after reaching the antiprompt:

(Whatever it is), say we 'Anon:'

With the gguf version, it continues to write like with a broken prompt a complete dialogue until the reached text is 'two times' the antiprompt:

Anon: Anon:

Otherwise, the system is just continuing to write a monologue without letting the user ever answer.

I checked common one time prompting too with gguf and it is working perfectly. It is only this interactive mode which is somehow broken.

# Environment and Context

- MacBookPro M1
- Python 3.10.8

Used model is **llama-2-13b-chat.Q8_0.gguf**

I am aware that llama2 has another prompt mask than in your demo but I would still expect it to stop reaching the antiprompt. + The absolute correct mask seems unpractical for interactive mode after the starting prompt anyway (which is not the topic now).

Libs:
- fastapi 0.97.0
- numpy 1.25.1
- llama_cpp_python 0.2.7

GNU Make 3.81
Apple clang version 15.0.0 (clang-1500.0.40.1)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。