abetlen / abetlen/llama-cpp-python

Demo of Interactive Chat ignores antiprompt with gguf

Abierto
#759 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
10.6k
Forks
1.4k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

# 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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.