File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -639,7 +639,7 @@ def _create_completion(
639639 self .detokenize ([token ]).decode ("utf-8" , errors = "ignore" )
640640 for token in all_tokens
641641 ]
642- all_logprobs = [Llama ._logits_to_logprobs ( row ) for row in self .eval_logits ]
642+ all_logprobs = [Llama .logits_to_logprobs ( list ( map ( float , row )) ) for row in self .eval_logits ]
643643 for token , token_str , logprobs_token in zip (
644644 all_tokens , all_token_strs , all_logprobs
645645 ):
@@ -985,7 +985,7 @@ def token_bos() -> llama_cpp.llama_token:
985985 return llama_cpp .llama_token_bos ()
986986
987987 @staticmethod
988- def logits_to_logprobs (logits : List [llama_cpp . c_float ]) -> List [llama_cpp . c_float ]:
988+ def logits_to_logprobs (logits : List [float ]) -> List [float ]:
989989 exps = [math .exp (float (x )) for x in logits ]
990990 sum_exps = sum (exps )
991- return [llama_cpp . c_float ( math .log (x / sum_exps ) ) for x in exps ]
991+ return [math .log (x / sum_exps ) for x in exps ]
You can’t perform that action at this time.
0 commit comments