mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-31 08:51:55 +00:00 
			
		
		
		
	common : fix incorrect print of non-ascii characters in the logging (#15466)
Signed-off-by: Jie Fu <jiefu@tencent.com>
This commit is contained in:
		| @@ -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); |         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 << "'" |         buf << "'" << detokenized << "'" | ||||||
|             << ":" << std::to_string(token); |             << ":" << 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]); |         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) |         buf << "\n"          << std::to_string(i) | ||||||
|             << ", token '"   << detokenized << "'" |             << ", token '"   << detokenized << "'" | ||||||
|             << ", pos "      << std::to_string(batch.pos[i]) |             << ", pos "      << std::to_string(batch.pos[i]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jie Fu (傅杰)
					Jie Fu (傅杰)