abetlen / abetlen/llama-cpp-python

Output of emojis seems to be somewhat broken

オープン
#608 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug quality
主要言語
Python
スター
10.6k
フォーク
1.4k
PR マージ指標
PR 指標を取得中

説明

# Expected Behavior

I am seeing some odd character output with certain emojis. Not all emojis, but certainly some, are not being output correctly.

# Current Behavior

When asking Llama2 model to respond using mostly emojis, some are output as follows:

> 🏋️\u200d♀️💪🏼👟🥊🚀🎉🤩👍

The \u200d plus the female symbol seems to be some kind of encoding issue

# Environment and Context

llama-cpp-python Version: 0.1.77 (latest at time of writing)
Python Version: 3.11.4
Platform: Apple M1 Macbook 16GB
Llama2 Model: llama-2-7b-chat.ggmlv3.q4_1.bin via [https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML](https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML)

# Steps to Reproduce

Here is a basic example, using the model file noted above, that seems to reliably re-create the issue

```python
from llama_cpp import Llama

prompt = """
[INST] <>
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe.
<>

Show me a list of fitness related emojis.[/INST]
"""

llm = Llama(
model_path="models/llama-2-7b-chat.ggmlv3.q4_1.bin",
n_gpu_layers=1,
n_ctx=2048,
n_batch=512,
f16_kv=True,
verbose=True
)

llm(prompt=prompt)
```

Produces the following output:

> {'id': 'cmpl-61a22458-6094-4ebc-9498-eac52c29570d',
'object': 'text_completion',
'created': 1691949830,
'model': '/Users/thomas/Hobbies/fff-pledge/llama-2-7b-chat.ggmlv3.q4_1.bin',
'choices': [{'text': '🏋️\u200d♀️💪🏼👟🥊🚀🎉🤩👍',
'index': 0,
'logprobs': None,
'finish_reason': 'stop'}],
'usage': {'prompt_tokens': 58, 'completion_tokens': 40, 'total_tokens': 98}}

I have tried multiple versions of the llama2 model, from [TheBloke](https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML), and despite the overall performance differences, the specific issue I am seeing remains.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。