]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
common : fix incorrect print of non-ascii characters in the logging (#15466)
authorJie Fu (傅杰) <redacted>
Thu, 21 Aug 2025 08:54:34 +0000 (16:54 +0800)
committerGitHub <redacted>
Thu, 21 Aug 2025 08:54:34 +0000 (11:54 +0300)
Signed-off-by: Jie Fu <redacted>
common/common.cpp

index 67dd5404fff9078a7558d34808aa83f955de13eb..decabcc2ed327ed8c9b07dea0b61a28e06ef4406 100644 (file)
@@ -558,13 +558,6 @@ std::string string_from(const struct llama_context * ctx, const std::vector<llam
 
         auto detokenized = common_token_to_piece(ctx, token);
 
-        detokenized.erase(
-            std::remove_if(
-                detokenized.begin(),
-                detokenized.end(),
-                [](const unsigned char c) { return !std::isprint(c); }),
-            detokenized.end());
-
         buf << "'" << detokenized << "'"
             << ":" << std::to_string(token);
     }
@@ -589,13 +582,6 @@ std::string string_from(const struct llama_context * ctx, const struct llama_bat
 
         auto detokenized = common_token_to_piece(ctx, batch.token[i]);
 
-        detokenized.erase(
-                std::remove_if(
-                    detokenized.begin(),
-                    detokenized.end(),
-                    [](const unsigned char c) { return !std::isprint(c); }),
-                detokenized.end());
-
         buf << "\n"          << std::to_string(i)
             << ", token '"   << detokenized << "'"
             << ", pos "      << std::to_string(batch.pos[i])