File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -541,16 +541,12 @@ struct completion_token_output {
541541 json to_json (bool post_sampling_probs) const {
542542 json probs_for_token = json::array ();
543543 for (const auto & p : probs) {
544- // If the predicted token id is the same as this.tok, then we use the text_to_send instead
545- // of the detokenized token. This is to avoid a mismatch between the text tokens where
546- // the text_to_send token may include a leading whitespace character but the detokenized
547- // token would not.
548- std::string txt = tok == p.tok ? text_to_send : p.txt ;
544+ std::string txt (p.txt );
549545 txt.resize (validate_utf8 (txt));
550546 probs_for_token.push_back (json {
551547 {" id" , p.tok },
552548 {" token" , txt},
553- {" bytes" , str_to_bytes (txt)},
549+ {" bytes" , str_to_bytes (p. txt )},
554550 {
555551 post_sampling_probs ? " prob" : " logprob" ,
556552 post_sampling_probs ? p.prob : logarithm (p.prob )
You can’t perform that action at this time.
0 commit comments