More test fixes

This commit is contained in:
Gaurav Garg
2026-07-15 22:56:35 +05:30
parent d9fe17bdad
commit 483169a47e
4 changed files with 137 additions and 139 deletions
+5 -1
View File
@@ -70,6 +70,7 @@ static llama_token sample_dist(llama_sampler * sampler, const std::vector<float>
llama_token_data_array cur_p = { cur.data(), cur.size(), -1, false };
llama_sampler_apply(sampler, &cur_p);
GGML_ASSERT(cur_p.selected >= 0);
GGML_ASSERT((size_t) cur_p.selected < cur_p.size);
return cur_p.data[cur_p.selected].id;
}
@@ -80,7 +81,10 @@ static void test_dist_singleton_rng() {
sample_dist(singleton, { 0.0f });
sample_dist(control, { 0.0f, 0.0f });
GGML_ASSERT(sample_dist(singleton, { 0.0f, 0.0f }) == sample_dist(control, { 0.0f, 0.0f }));
const std::vector<float> logits(256, 0.0f);
for (int i = 0; i < 4; ++i) {
GGML_ASSERT(sample_dist(singleton, logits) == sample_dist(control, logits));
}
llama_sampler_free(singleton);
llama_sampler_free(control);