aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Renda <alexrenda@users.noreply.github.com>2023-06-24 03:15:01 -0700
committerGitHub <noreply@github.com>2023-06-24 13:15:01 +0300
commitb061ba9e2a7a2c335a200df8c11aed5e31e4ccbb (patch)
tree0bf01d16d556af5ab9a3990d8859a5ff1f3ea4c0 /tests
parent527b6fba1d237befb324fd846bda7418c0fa394d (diff)
llama : fix top-p sampling to match the canonical definition (#1953)
* Fix top-p sampling to match the standard definition (smallest set that has probability mass at least p, not largest set with probability mass less than p) * top-p: correct gt to gte * add test for correct top-p behavior
Diffstat (limited to 'tests')
-rw-r--r--tests/test-sampling.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test-sampling.cpp b/tests/test-sampling.cpp
index 5d693f7..64f9455 100644
--- a/tests/test-sampling.cpp
+++ b/tests/test-sampling.cpp
@@ -181,6 +181,7 @@ int main(void) {
test_top_p({0.1f, 0.2f, 0.3f, 0.4f}, {0.4f}, 0);
test_top_p({0.1f, 0.2f, 0.3f, 0.4f}, {0.4f, 0.3f}, 0.7f);
+ test_top_p({0.1f, 0.2f, 0.3f, 0.4f}, {0.4f, 0.3f, 0.2f}, 0.8f);
test_top_p({0.1f, 0.2f, 0.3f, 0.4f}, {0.4f, 0.3f, 0.2f, 0.1f}, 1);
test_tfs({0.1f, 0.15f, 0.2f, 0.25f, 0.3f}, {0.3f}, 0.25f);