fix: fix logprobs when BOS is not present (#1471)
* Fix lobprobs when BOS is not present * Fix logprobs when bos is not available
This commit is contained in:
parent
027f7bc678
commit
6e0642ca19
1 changed files with 2 additions and 2 deletions
|
@ -1410,8 +1410,8 @@ class Llama:
|
||||||
top_logprobs: List[Optional[Dict[str, float]]] = []
|
top_logprobs: List[Optional[Dict[str, float]]] = []
|
||||||
|
|
||||||
if echo:
|
if echo:
|
||||||
# Remove leading BOS token
|
# Remove leading BOS token if exists
|
||||||
all_tokens = prompt_tokens[1:] + completion_tokens
|
all_tokens = prompt_tokens[1 if prompt_tokens[0] == self.token_bos() else 0:] + completion_tokens
|
||||||
else:
|
else:
|
||||||
all_tokens = completion_tokens
|
all_tokens = completion_tokens
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue