summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorkalomaze <66376113+kalomaze@users.noreply.github.com>2024-02-02 08:15:30 -0600
committerGitHub <noreply@github.com>2024-02-02 16:15:30 +0200
commit191221178f51b6e81122c5bda0fd79620e547d07 (patch)
tree8b990f818ce3bf08e09a6faeabcdd22b6cbc4db0 /examples
parente437b37fd0b2b97e6c6ff1045ec7f901faa6498a (diff)
perplexity : fix KL divergence calculations on Windows (#5273)
Diffstat (limited to 'examples')
-rw-r--r--examples/perplexity/perplexity.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp
index 8d220496..4b08145c 100644
--- a/examples/perplexity/perplexity.cpp
+++ b/examples/perplexity/perplexity.cpp
@@ -457,14 +457,14 @@ static results_perplexity perplexity(llama_context * ctx, const gpt_params & par
std::ofstream logits_stream;
if (!params.logits_file.empty()) {
- logits_stream.open(params.logits_file.c_str());
+ logits_stream.open(params.logits_file.c_str(), std::ios::binary);
if (!logits_stream.is_open()) {
fprintf(stderr, "%s: failed to open %s for writing\n", __func__, params.logits_file.c_str());
return {};
}
fprintf(stderr, "%s: saving all logits to %s\n", __func__, params.logits_file.c_str());
logits_stream.write("_logits_", 8);
- logits_stream.write((const char *)&n_ctx, sizeof(n_ctx));
+ logits_stream.write(reinterpret_cast<const char *>(&n_ctx), sizeof(n_ctx));
}
auto tim1 = std::chrono::high_resolution_clock::now();