test-cli: greedy sampling + print exception messages

This commit is contained in:
ochafik 2024-10-31 00:10:44 +00:00
parent 030fda09a9
commit 82d5e91a6f

View file

@ -53,6 +53,7 @@ static Out run(const std::string & cmd) {
int main(int argc, char ** argv) {
std::string cli_bin = argc == 2 ? argv[1] : "./llama-cli";
try {
std::system("mkdir out/");
{
@ -63,14 +64,18 @@ int main(int argc, char ** argv) {
}
{
auto p = run(cli_bin + " -hfr ggml-org/models -hff tinyllamas/stories260K.gguf --prompt hello --seed 42 -ngl 0 -n 10");
assert_equals(" hello Joe and Joe we", p.out);
auto p = run(cli_bin + " -hfr ggml-org/models -hff tinyllamas/stories260K.gguf --prompt hello --seed 42 --samplers top-k --top-k 1 -ngl 0 -n 10");
assert_equals(" hello was a big, red ball. He", p.out);
assert_contains("system_info:", p.err);
}
{
auto p = run(cli_bin + " -hfr ggml-org/models -hff tinyllamas/stories260K.gguf --prompt hello --seed 42 -ngl 0 -n 10 --log-disable");
assert_equals(" hello Joe and Joe we", p.out);
auto p = run(cli_bin + " -hfr ggml-org/models -hff tinyllamas/stories260K.gguf --prompt hello --seed 42 --samplers top-k --top-k 1 -ngl 0 -n 10 --log-disable");
assert_equals(" hello was a big, red ball. He", p.out);
assert_equals("", p.err);
}
} catch (const std::exception & ex) {
std::cerr << "[test-cli] Error: " << ex.what() << std::endl;
return 1;
}
}