Skip to content

Commit bc3760a

Browse files
Windows test
1 parent d19527b commit bc3760a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test-sampling.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "llama.h"
2-
#include <assert.h>
3-
#include <math.h>
2+
#include <cassert>
3+
#include <cmath>
44
#include <numeric>
55
#include <cassert>
66
#include <iostream>
@@ -20,15 +20,19 @@ void dump(const llama_token_data_array * candidates) {
2020
void test_top_k(const std::vector<float> & probs,
2121
const std::vector<float> & expected_probs,
2222
int k) {
23+
printf("%s:%d (%s)\n", __FILE__, __LINE__, __func__);
2324
size_t n_vocab = probs.size();
2425
std::vector<llama_token_data> candidates;
2526
candidates.reserve(n_vocab);
2627
for (llama_token token_id = 0; token_id < (llama_token)n_vocab; token_id++) {
27-
float logit = log(probs[token_id]);
28+
printf("%s:%d (%s) token_id: %d\n", __FILE__, __LINE__, __func__, token_id);
29+
float logit = std::log(probs[token_id]);
2830
candidates.emplace_back(llama_token_data{token_id, logit, 0.0f});
2931
}
32+
printf("%s:%d (%s)\n", __FILE__, __LINE__, __func__);
3033

3134
llama_token_data_array candidates_p = { candidates.data(), candidates.size(), false };
35+
printf("%s:%d (%s)\n", __FILE__, __LINE__, __func__);
3236
llama_sample_softmax(nullptr, &candidates_p);
3337
DUMP(&candidates_p);
3438
llama_sample_top_k(nullptr, &candidates_p, k);

0 commit comments

Comments
 (0)