support echo=true and logprobs in openai api when logprobs=1 in lm-evaluation-harness (#1998)

This commit is contained in:
Xiaoyu Zhang
2024-11-12 15:21:20 +08:00
committed by GitHub
parent b808a38365
commit 027e65248f
2 changed files with 8 additions and 2 deletions

View File

@@ -498,6 +498,10 @@ def v1_generate_request(
)
prompts.append(request.prompt)
if request.echo and request.logprobs:
current_logprob_start_len = 0
else:
current_logprob_start_len = -1
sampling_params_list.append(
{
"temperature": request.temperature,
@@ -517,7 +521,7 @@ def v1_generate_request(
}
)
return_logprobs.append(request.logprobs is not None and request.logprobs > 0)
logprob_start_lens.append(-1)
logprob_start_lens.append(current_logprob_start_len)
top_logprobs_nums.append(
request.logprobs if request.logprobs is not None else 0
)