Skip to content

Commit 7fde5d4

Browse files
committed
Revert "server : use text_to_send instead of detokenized token"
This reverts commit 0f66d99.
1 parent 0f66d99 commit 7fde5d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

examples/server/server.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)