abetlen / abetlen/llama-cpp-python

top_p = 1 causes deterministic outputs

未关闭
#1,797 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
10.6k
派生
1.4k
PR 合并指标
PR 指标待抓取

描述

Setting `top_p = 1` causes outputs to be identical even with a random seed. This was discovered by https://github.com/oobabooga/text-generation-webui/issues/6431#issuecomment-2409089861. See the full issue at https://github.com/oobabooga/text-generation-webui/issues/6431.

### Reproduction

```python
from llama_cpp import Llama

# Load the model
model = Llama(
model_path="models/Meta-Llama-3-8B-Instruct-Q4_K_S-HF/Meta-Llama-3-8B-Instruct-Q4_K_S.gguf",
n_gpu_layers=128,
)

# Define the prompt
prompt = "Once upon a time"

for i in range(5):
# Generate text with temperature = 1
completion = model.create_completion(prompt=prompt, max_tokens=50, temperature=1.0, top_p=1.0, seed=-1)

# Print the generated text
print(completion['choices'][0]['text'])

```

The 5 outputs will be identical.

Verified with **`llama-cpp-python==0.3.1`**.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。